Problem B
Baby Shark
Baby shark
Doo doo doo doo doo doo
Baby shark, doo doo doo doo doo doo
Baby shark, doo doo doo doo doo doo
Baby shark!
(Additional verses refer to Mommy Shark, Daddy Shark, Grandma Shark, Grandpa Shark, Let’s Go Hunt, Run Away, Safe at Last, and It’s the End.)
Notice that the word “doo” is repeated six times consecutively in lines 2, 3, and 4. (We ignore case, e.g., the uppercase “D” in line 2.)
Given a line of text, determine the maximum number of consecutive repetitions of a word. A word is defined as any sequence of characters separated by whitespace or by the start or end of the line.
Input
The input consists of a single line containing at least one word of English-like text composed of lowercase letters. Words are separated by single spaces, and spaces are not part of any word. The line contains at most 80 characters.
Output
Print the word, in all lowercase, that occurs consecutively the most times. If multiple words are tied for the maximum number of consecutive repetitions, print the first such word in the input line (not in alphabetical order).
| Sample Input 1 | Sample Output 1 |
|---|---|
baby shark doo doo doo doo doo doo |
doo |
| Sample Input 2 | Sample Output 2 |
|---|---|
baby shark |
baby |
| Sample Input 3 | Sample Output 3 |
|---|---|
no no no i wont wont wont |
no |
