LearnPy Hub
← Dictionaries problems
Hard

Pair Frequency

Read a word and count every pair of adjacent letters. Print the most common pair and its count; if tied, the pair that comes first alphabetically.

Input

One word (at least 2 letters).

Output

pair count

Sample 1

Input
banana
Output
an 2

Sample 2

Input
ab
Output
ab 1
solution.py
Output appears here
Pair Frequency · Python practice problem · LearnPy Hub