#include <iostream>
#include <map>
int main() {
std::map<char, int> charCount; // Step 1: Declare a map with key type char and value type int
std::string inputString;
std::cout << "Enter a string: ";
std::getline(std::cin, inputString); // Step 2: Accept a string input
for (char c : inputString) {
if (isalpha(c)) {
charCount[c]++; // Step 3: Increment the count for each character in the map
}
}
std::cout << "Character frequency:\n";
for (const auto& pair : charCount) {
std::cout << pair.first << ": " << pair.second << "\n"; // Step 4: Display the character frequency
}
return 0;
}