#include #include #include using Table = std::map; int main() { Table words; std::string s; while (std::cin >> s) // für jedes Wort der Eingabe { ++ words[s]; // ein Strich in Wortliste } std::cout << "Anzahl\tWort\n" << endl; // danach sortiert ausgeben for (auto [word, cnt] : words) std::cout << cnt << '\t' << word << '\n'; }