void countCharImproved(char *str) {
std::map<char, int> count;
int l = strlen(str);
for(int i=0; i<l; i++) {
count[str[i]]++;
}
for(const auto kvp : count) {
std::cout << kvp.first << " occurs " << kvp.second << " times
";
}
}