Problem B
Thore's self-esteem
Input
The first line of the input contains a single number $n$, where $1 < n \leq 100$.
Then follows $n$ lines with a name on each line.
Each name only contains characters from the set $\big [\text {a-zA-Z}\big ]$, i.e. lower and upper case English letters. Each name is at least one character and at most $100$ characters long.
Exactly one name is “ThoreHusfeldt” in the input.
Output
The output is a single line. If “ThoreHusfeldt” is first on the scoreboard, output “Thore is awesome”. If another person, with a name containing “ThoreHusfeld”(note: no trailing “t”) as a prefix is above Thore, output “Thore sucks”.
Otherwise output the smallest prefix that uniquely determines Thore on the scoreboard from the top. In other words: find the smallest prefix of “ThoreHusfeldt” that no-one above “ThoreHusfeldt” shares.
Sample Explanation
In Sample Input $1$ there is another Thore above “ThoreHusfeldt”. However, “ThoreHusfeldt” is still the best “ThoreH”.
Sample Input 1 | Sample Output 1 |
---|---|
2 ThoreTiemann ThoreHusfeldt |
ThoreH |
Sample Input 2 | Sample Output 2 |
---|---|
2 ThoreHusfeldt JohanSannemo |
Thore is awesome |
Sample Input 3 | Sample Output 3 |
---|---|
2 ThoreHusfeldter ThoreHusfeldt |
Thore sucks |
Sample Input 4 | Sample Output 4 |
---|---|
2 JohanSannemo ThoreHusfeldt |
T |