Character frequency
Read a lowercase word and print each distinct character with its count, in order of first appearance.
Input
One lowercase word.
Output
Pairs like b1 a3 n2, space-separated.
Constraints
1 ≤ length ≤ 10^5.
Example 1
Input:
banana
Output:
b1 a3 n2Example 2
Input:
level
Output:
l2 e2 v1Hint: Use a dictionary or an array of 26 counts, and remember first-appearance order.