A signal-monitoring station listens to a broadcast and writes down every symbol it decodes as a single lowercase letter, producing one continuous log for the session. The station's calibration table splits the alphabet into two fixed families: the five tone letters -- 'a', 'e', 'i', 'o', and 'u' -- and the remaining twenty-one letters, every one of which is classified as a pulse letter.
To summarize a session, the station computes its dominance score: the number of times the single most-repeated tone letter appears in the log, plus the number of times the single most-repeated pulse letter appears in the log. (Different letters may repeat different numbers of times; only the largest count within each family matters.)
Given the session log, report the dominance score.
Example 1
Input
aabbbccddee
Expected
5
Explanation
Letter counts are a=2, b=3, c=2, d=2, e=2. Among the tone letters present, only 'a' (2) and 'e' (2) occur, so the peak tone count is 2. Among the pulse letters present, 'b' occurs 3 times, which is the largest pulse count. The dominance score is 2 + 3 = 5.
Example 2
Input
zzzzooo
Expected
7
Explanation
Letter counts are z=4, o=3. The only tone letter present is 'o', with count 3, so the peak tone count is 3. The only pulse letter present is 'z', with count 4, so the peak pulse count is 4. The dominance score is 3 + 4 = 7.
Ready to solve this?
Sign in to open the editor, run your code against the sample tests, and submit against the full test suite.
Sign in to solve →