시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 256 MB110908785.294%

문제

Gru and Lucy are trying to break into El Macho’s lair. They arrive at a hallway that they need to walk across, which is likely booby-trapped. The hallway is a single line of squares, each of which is annotated either X or O. Gru believes that the only “safe” squares are the ones that comprise the longest subsequence of X’s, i.e., the longest contiguous set of squares that are all annotated X.

Your goal is to help Gru find the safe squares to jump on.

입력

The first line in the test data file contains the number of test cases (< 100). After that, each line contains one test case: the first number is the number of entries in the sequence, n (provided as an int), and the next n Strings (which can only be “X” or “O”) are the sequence itself.

출력

For each test case, you are to find the longest subsequence of consecutive X’s, and output the number of X’s in that sequence. The exact format is shown below in the examples.

출력 형식

정확한 출력 형식은 제출에서 언어를 Java로 설정하면 확인할 수 있다.

예제 입력 1

3
10 X O O O O X O O O X  
5 O O O O O
4 X X X X 

예제 출력 1

The longest contiguous subsequence of X's is of length 1
The longest contiguous subsequence of X's is of length 0
The longest contiguous subsequence of X's is of length 4