This is my current approach. This function tallys up all the word. the problem is that the line

wordList.erase

that's inside the for loop
produces an out of bounds error, so I cant remove the duplicate entry that way.
I also tried the unique() approach, but that doesn't seem to work it only removes some entries.

What is the most efficient way to reduce a vector of pairs to only unique elements?