|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||128 MB||0||0||0||0.000%|
Joe claims that he has telekinetic abilities. This statement has shocked Stan, who is a confirmed rationalist, and he immediately wanted Joe to prove it.
Joe decided to toss a coin to show what he is capable of. He says that he can do it in such a way, that there will be exactly k times more heads than tails. Stan has written down the results for all tosses and now he wants to find the longest sequence of consecutive tosses, in which heads are exactly k times more common than tails.
The first line of the standard input contains two integers n and k (3 ≤ n ≤ 1 000 000, 2 ≤ k ≤ n - 1). The first is the number of tosses made by Joe, whereas the meaning of the second number has already been described in the task statement. The second line contains a sequence of n characters describing the outcomes of consecutive tosses. It consists of letters
R denoting heads and tails respectively.
Your program should output one integer to the first and only line of the standard output equal to the length of the longest sequence of consecutive tosses, in which there are exactly k times more heads than tails. If such sequence does not exist, your program should output 0.
15 3 RORROOROOROOORO
The series from fifth to twelfth as well as from sixth to thirteenth toss contain exactly 6 heads and 2 tails, i.e., three times more heads than tails. There does not exist a longer sequence with this property.