#include<iostream>
#include<string>
#include<cctype>

std::string to_lower(std::string s)
{
    std::string result;
    for (auto ch : s)
        result += std::tolower(ch);
    return result;
}

std::string clean(std::string s)
{
    std::string result;
    for (auto ch : s)
        if (isalpha(ch))
            result += ch;

    return result;
}

std::string process(std::string s)
{
    return to_lower(clean(s));
}

unsigned as_index(char ch)
{
    return ch - 'a';
}

std::string get_line(std::string prompt)
{
    std::string line;

    std::cout << prompt;
    std::getline(std::cin, line);
 
    return line;
}

int main()
{
    const unsigned counts_size = 26;
    int counts[counts_size] = {};    // initialize all elements to 0.

    std::string raw_text = get_line("Enter a string:\n> ");
    std::string text = process(raw_text);

    for (unsigned i = 0; i < text.length(); ++i)
        ++counts[ as_index(text[i]) ];

    for (unsigned i = 0; i < text.length(); ++i)
        std::cout << text[i] << ": " << counts[ as_index(text[i]) ] << '\n';
}