93. Character Frequency
EasyHash Map
The string has only lowercase letters. For each letter that appears, print the letter and its count, in alphabetical order, one per line.
Input format
A single line s.
Output format
Lines of the form letter count.
Example 1
Input
banana
Output
a 3 b 1 n 2
Example 2
Input
abc
Output
a 1 b 1 c 1
Constraints
1 ≤ |s| ≤ 10⁵
Read input from standard input and print the answer to standard output. Your code is judged against 5 test cases, most of them hidden.
Loading the MyLoginn IDE…