Second most frequent letter P70269


Statement
 

pdf   zip

html

Which is the second most frequent letter in a given word?

Input

Input consists of cases, each case being a word formed only by lower-case letters; each word comes in a line. The word has at least two different letters.

Output

For each word, your program must print the second most frequent letter. All ties are to be resolved in favor of the alphabetically smallest letter.

Public test cases
  • Input

    aaaabbbccd
    edcba
    zazaz
    zaza
    

    Output

    b
    b
    a
    z
    
  • Information
    Author
    Salvador Roura
    Language
    English
    Translator
    Jose Luis Balcazar
    Original language
    Catalan
    Other languages
    Catalan
    Official solutions
    C++ Python
    User solutions
    C++ Python