Common Phrase

I made a c++ program that looks through a text file named data.txt and finds the most common x word phrase where x is a chosen number. In the screenshot I used the most common 3 word phrase and listed the top 20 (I can also list the least commonly used phrases) from a file that contained a bunch of wikipedia articles that I crawled using a java web crawler I wrote. This project was particularly difficult to optimize. The first version of the program was very very slow, but I soon used lots of pointers, lots of optimization techniques I thought of, and clever memory management, the final version is lightning fast compared to its predecessor.