DailyProgrammer Mini challenge : Character Occurrence Count

Felt like doing a little C programming today. So I attempted today’s ‘Mini challenge’ problem from Reddit’s r/dailyprogrammer. The challenge was to write a program to count the number of occurrences of alphabets contained in a string.

Here’s the problem statement,

Count it – count the letters in a string.

Given: A string – like “Hello World”

Output: Letters and how often they show up. – d:1 e:1 h:1 l:3 o:2 r:1 w:1

Special: convert all to lowercase. Ignore whitespace and anything not [a-z][A-Z]

Challenge input: “The quick brown fox jumps over the lazy dog and the sleeping cat early in the day.”

And here’s my solution,

Do leave your comments & suggestions 🙂