Heavy-Light Composition | 프로그래밍의 벗 PivotOJ
PivotOJ

Heavy-Light Composition

시간 제한: 1000ms메모리 제한: 1024MB출처: CCC 2024 SeniorBOJ 32365

문제

In a string containing only lowercase letters of the alphabet (“a” through “z”), we say a letter is heavy if it appears more than once in the string, and light otherwise.

We will be given a number of strings. For each string, we would like to determine whether the letters of the string alternate between light and heavy.

입력

The first line of input will consist of two positive integers T and N, representing the number of strings and the length of each string.

The next T lines each contain a sequence of N lowercase letters of the alphabet.

출력

Output T lines, where each line will be either T or F. If the i-th input string does alternate between light and heavy letters, the i-th line of output should be T; and otherwise, the i-th line of output should be F.

예제

예제 1

입력
3 4
abcb
bcbb
babc
출력
T
F
T

예제 2

입력
2 3
abc
bcb
출력
F
T
코드를 제출하려면 로그인하세요.