atcoder#ARC077D. [ARC077F] SS
[ARC077F] SS
Score : points
Problem Statement
We will call a string that can be obtained by concatenating two equal strings an even string.
For example, xyzxyz
and aaaaaa
are even, while ababab
and xyzxy
are not.
For a non-empty string , we will define as the shortest even string that can be obtained by appending one or more characters to the end of .
For example, abaaba
abaababaab
.
It can be shown that is uniquely determined for a non-empty string .
You are given an even string consisting of lowercase English letters. For each letter in the lowercase English alphabet, find the number of its occurrences from the -th character through the -th character of .
Here, is the string obtained by applying to times.
Constraints
- is an even string consisting of lowercase English letters.
- and are integers.
Input
Input is given from Standard Input in the following format:
Output
Print integers in a line with spaces in between. The -th integer should be the number of the occurrences of the -th letter in the lowercase English alphabet from the -th character through the -th character of .
abaaba
6 10
3 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Since abaaba
abaababaab
, the first ten characters in is also abaababaab
. Thus, the sixth through the tenth characters are abaab
. In this string, a
appears three times, b
appears twice and no other letters appear, and thus the output should be and followed by twenty-four s.
xx
1 1000000000000000000
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1000000000000000000 0 0
vgxgpuamkvgxgvgxgpuamkvgxg
1 1000000000000000000
87167725689669676 0 0 0 0 0 282080685775825810 0 0 0 87167725689669676 0 87167725689669676 0 0 87167725689669676 0 0 0 0 87167725689669676 141040342887912905 0 141040342887912905 0 0