Computing word-frequency-table
@Deduplicator said almost everything, I will only add that it's really important that you know algorithms and data structures from the STL and using the proper in each case.
Here, you do so much work for nothing:

#include &lt;algorithm&gt;
#include &lt;iostream&gt;
#include &lt;iterator&gt;
#include &lt;string&gt;
#include &lt;map&gt;

int main() {
    auto in = std::istream_iterator&lt;std::string&gt;{std::cin};
    auto out = std::map&lt;std::string, int&gt;{};

    std::for_each(in, {}, [&amp;out](const std::string&amp; w) { out[w]++; });
    for (auto&amp; w : out) { std::cout &lt;&lt; w.first &lt;&lt; ' ' &lt;&lt; w.second &lt;&lt; '\n'; }
}