#K54667. Letter Frequency Counter
Letter Frequency Counter
Letter Frequency Counter
This problem requires you to count the frequency of each alphabet letter (a–z) in a given text string. The counting is case‐insensitive, meaning that both uppercase and lowercase letters are treated as the same. Non-alphabetic characters must be ignored.
The output should list each letter from a to z followed by a colon, a space, and the corresponding frequency count. Each letter-frequency pair should appear on its own line, in alphabetical order. Your solution must read input from standard input (stdin) and write the result to standard output (stdout).
For example, if the input is "Hello World", the expected output is:
a: 0 b: 0 c: 0 d: 1 e: 1 f: 0 g: 0 h: 1 i: 0 j: 0 k: 0 l: 3 m: 0 n: 0 o: 2 p: 0 q: 0 r: 1 s: 0 t: 0 u: 0 v: 0 w: 1 x: 0 y: 0 z: 0
inputFormat
The input consists of a text string which may span multiple lines. Treat the entire input as one string.
outputFormat
Print 26 lines of output. Each line should contain a lowercase letter from a to z, followed by a colon, a space, and the count of that letter in the input. The letters must be output in alphabetical order.
## sampleHello World
a: 0
b: 0
c: 0
d: 1
e: 1
f: 0
g: 0
h: 1
i: 0
j: 0
k: 0
l: 3
m: 0
n: 0
o: 2
p: 0
q: 0
r: 1
s: 0
t: 0
u: 0
v: 0
w: 1
x: 0
y: 0
z: 0
</p>