Загрузка данных


#include <iostream>
#include <string>
#include <map>
#include <sstream>
#include <iomanip>

int main() {
    std::string text = "hello world hello c++ world";

    std::map<std::string, int> freq;

    std::istringstream iss(text);

    std::string word;

    while (iss >> word)
        ++freq[word];

    for (const auto& p : freq)
        std::cout << std::setw(10)
                  << p.first
                  << ": "
                  << p.second
                  << '\n';

    return 0;
}