S2. Heavy-Light Composition
의견: 0
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 | 34점 | \(2 \le T \le 4\) — \(2 \le N \le 4\) — Only the letters "a" and "b" will be used |
2 | 33점 | \(2 \le T \le 10\) — \(2 \le N \le 30\) — None |
3 | 13점 | \(2 \le T \le 100\) — \(2 \le N \le 100\) — Only the letter "a" will be heavy; all other letters are light |
4 | 20점 | \(2 \le T \le 10\ 000\) — \(2 \le N \le 100~~\) — None |
3 4
abcb
bcbb
babcT
F
TThe first string is composed of a light letter, then a heavy letter,
then a light letter, and then a heavy letter.
The second string ends in two consecutive heavy letters.
The third string is composed of a heavy letter, then a light letter,
then a heavy letter, and then a light letter.
2 3
abc
bcbF
TThe first string is composed of all light letters.
The second string is composed of a heavy letter, then a light letter,
and then a heavy letter.
평가 및 의견
S2. Heavy-Light Composition
Log in to rate problems.
아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.
풀이 제출
S2. Heavy-Light Composition