There are many action superheroes out there: Batman, Spiderman, Superman, Icantwriteman etc. Among them, there is one gentleman called Kickass. Today he wants to mimic Spiderman, so he has chosen a row of tall skyscrapers to jump around on.
Specifically, he has chosen a sequence of
Find the maximum number of different skyscrapers Kickass can visit in a chain of jumps starting
from the skyscraper numbered
Input Specification
The first line of input contains the two integers
The second line of input contains
The third line of input contains a sequence of .
or T
. If the T
, then there
is a trampoline positioned on the top of skyscraper
Output Specification
The first and only line of output must contain the required maximum number of visited skyscrapers.
Sample Input 1
6 4
12 16 16 16 14 14
.T....
Sample Output 1
5
Sample Input 2
10 1
10 7 3 1 1 9 8 2 4 10
..T..T....
Sample Output 2
7
Explanation for Sample Output 2
The sequence of visited skyscrapers could be the following:
Comments