Function Kata “Count Characters”
Write a function to count the number of occurrences of characters in a string. The input to the function is a string, its output a Dictionary (map) of char/int pairs.
IDictionary<char, int> CountCharacters(string input)
Processing the string “HelLo wOrld” would result in:
H:1, e:1, l:2, L:1, o:1, w:1, O:1, r:1, d:1, _:1
Variations #1
Handle upper and lower case the same. The string “HelLo wOrld” would then result in:
H:1, e:1, l:3, o:2, w:1, r:1, d:1, _:1
“I am the founder of Majer Consulting and Majer Training and an experienced software developer, trainer and consultant. I have been on the road in the SAP world since 1998, supporting numerous projects, and have developed a passion for software engineering, software testing and agile development methods such as TDD. When I am not servicing customers or holding seminars, I am speaking at conferences or writing my next book.”