91. Letter Frequency

Acceptance — 0 accepted 0 submissions

Easy
HashingStrings
No companies listed
A Scrabble player wants to know how many times each letter appears in a word.

Print every letter present, with its count, in alphabetical order.

Input Format
A single word in lowercase letters.

Output Format
For each letter that appears, in alphabetical order, print a line: <letter> <count>

Constraints
• 1 ≤ length ≤ 1000

Example 1

Input
banana
Output
a 3
b 1
n 2

Explanation a appears 3 times, b once and n twice.

Example 2

Input
zebra
Output
a 1
b 1
e 1
r 1
z 1

Explanation Every letter once, printed in a to z order.

Example 3

Input
aaaa
Output
a 4

Explanation Only a, 4 times.

Acceptance —
Accepted 0
Submissions 0
Auto-save
Saved Ln 1, Col 1
Submit a solution to see its status here.
Input
Expected Output
a 3 b 1 n 2
No results yet
Run your code to test it against the sample cases.
Problem List