Canadian Computing Competition: 2024 Stage 1, Senior #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 and , representing the number of strings and the length of each string.
The next lines each contain a sequence of lowercase letters of the alphabet.
The following table shows how the available 15 marks are distributed:
| Marks | Bounds on | Bounds on | Other Restrictions |
|---|---|---|---|
| 5 | Only the letters a and b will be used | ||
| 5 | None | ||
| 2 | Only the letter a will be heavy; all other letters are light | ||
| 3 | None |
Output lines, where each line will be either T or F. If the -th input string does alternate between light and heavy letters, the -th line of output should be T; and otherwise, the -th line of output should be F.
The 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.
The 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.
No comments yet. Be the first to comment!