#include #include #include #include #include using namespace std; int main() { vector text { istream_iterator{cin}, istream_iterator{} }; vector words {text}; sort(begin(words), end(words)); words.erase(unique(begin(words), end(words)), end(words)); transform(begin(words), end(words), ostream_iterator{cout, "\n"}, [&text](string const& word) { int n{count(begin(text), end(text), word)}; return word + ": " + to_string(n); }); }