Dr. Astro Insky works at a radiotelescope centre. Recently, she noticed a very curious microwave pulsing emission sent right from the centre of the galaxy. Is the emission transmitted by some extraterrestrial form of intelligent life? Or is it nothing but the usual heartbeat of the stars?
Task
You must help Dr. Insky to find out the truth by providing a tool to analyse bit patterns in the files she records. Dr. Insky wants to find the patterns of length between (and including)
Input Specification
The input contains the data series, with the following format:
- First line - The integer
A
indicating the minimum pattern length. - Second line - The integer
B
indicating the maximum pattern length. - Third line - The integer
N
indicating the number of distinct frequencies. - Fourth line - A sequence of
0
and1
characters, terminated by a2
character.
Sample Input
2
4
10
010100100100010001111011000010100110011110000100100111100100000002
This asks for the top ten frequencies of patterns of length between two and four that occur in the bit pattern
01010010010001000111101100001010011001111000010010011110010000000
In this example, pattern 100
occurs 1000
occurs 00
.
Output Specification
A report with at most
Sample Output
For the sample input above, the output must be
23 00
15 10 01
12 100
11 001 000 11
10 010
8 0100
7 1001 0010
6 0000 111
5 1000 110 011
4 1100 0011 0001
Constraints
The input may be up to 2 megabytes. The parameters
Comments
What is the maximum size of the sequence?
Max length is
.