atcoder#ARC077D. [ARC077F] SS

[ARC077F] SS

Score : 11001100 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 SS, we will define f(S)f(S) as the shortest even string that can be obtained by appending one or more characters to the end of SS. For example, f(f(abaaba)=)=abaababaab. It can be shown that f(S)f(S) is uniquely determined for a non-empty string SS.

You are given an even string SS consisting of lowercase English letters. For each letter in the lowercase English alphabet, find the number of its occurrences from the ll-th character through the rr-th character of f10100(S)f^{10^{100}} (S).

Here, f10100(S)f^{10^{100}} (S) is the string f(f(f(...f(S)...)))f(f(f( ... f(S) ... ))) obtained by applying ff to SS 1010010^{100} times.

Constraints

  • 2S2×1052 \leq |S| \leq 2\times 10^5
  • 1lr10181 \leq l \leq r \leq 10^{18}
  • SS is an even string consisting of lowercase English letters.
  • ll and rr are integers.

Input

Input is given from Standard Input in the following format:

SS

ll rr

Output

Print 2626 integers in a line with spaces in between. The ii-th integer should be the number of the occurrences of the ii-th letter in the lowercase English alphabet from the ll-th character through the rr-th character of f10100(S)f^{10^{100}} (S).

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 f(f(abaaba)=)=abaababaab, the first ten characters in f10100(S)f^{10^{100}}(S) 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 33 and 22 followed by twenty-four 00s.

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