#include <locale>
#include <iostream>
#include <algorithm>
#include <iterator>
#include <vector>
#include <sstream>
#include <string>
#include <map>

class my_ctype : public
std::ctype<char>
{
    mask my_table[table_size];
public:
    my_ctype(size_t refs = 0)  
        : std::ctype<char>(&my_table[0], false, refs)
    {
        std::copy_n(classic_table(), table_size, my_table);
        my_table['-'] = (mask)space;
        my_table['\''] = (mask)space;
        my_table['.'] = (mask)space;
        my_table[','] = (mask)space;
        my_table[';'] = (mask)space;
        my_table[':'] = (mask)space;
        my_table['!'] = (mask)space;
        my_table['!'] = (mask)space;
    }
};

int main() {
    std::istringstream input("yoba,batya;batya-pidor!krestoblyad");
    std::locale x(std::locale::classic(), new my_ctype);
    input.imbue(x);
    std::map<std::string, int> dict;

    while (input.good()) {
    	std::string s;
    	input >> s;
    	dict[s]++;
    }
    
    for (auto s : dict) {
        std::cout << s.first << ":" << s.second << std::endl;
    }
    
    return 0;
}
