A relay signal is recorded as a string of English letters, where each letter may be transmitted in a bright tone (uppercase) or a dim tone (lowercase). A letter is considered fully paired if both its bright form and its dim form appear somewhere in the signal.
Given the signal string, find the alphabetically greatest fully paired letter and report it in its bright (uppercase) form. If no letter is fully paired, report nothing.
A single line containing the signal string s.
Print the greatest fully paired letter as a single uppercase character. If there is no fully paired letter, print an empty line.
Example 1
Input
bBdDzZaA
Expected
Z
Explanation
Every letter a, b, d, and z appears in both bright (uppercase) and dim (lowercase) form in the signal, so all four are fully paired. The alphabetically greatest of these is z, printed in its bright form as Z.
Example 2
Input
abcdef
Expected
(empty)Explanation
The signal contains only dim (lowercase) letters and no bright (uppercase) letters at all, so no letter is fully paired. The output is an empty line.
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 →