Heavy-Light Composition

시간 제한1초메모리 제한1024 MB

요약
T개의 문자열마다 각 문자가 두 번 이상 나오는 heavy인지 한 번만 나오는 light인지 따져, 이 둘이 번갈아 나타나는지 판정한다.
난이도

쉬움10점 중 2점

유형
해시맵, 문자열, 구현
정답자
아직 제출이 없습니다

문제

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.

예제2

  1. 예제 1

    입력
    3 4
    abcb
    bcbb
    babc
    
    예상 출력
    T
    F
    T
    
  2. 예제 2

    입력
    2 3
    abc
    bcb
    
    예상 출력
    F
    T