I wanted to say thanks for all the replies. Decrementing j instead, got my code to work. I like dusktreader's alternative. Originally I wanted to set the dupes to null but I did not want to overwrite any values.
Yes this was for homework. I desperately need to learn the STL. My school for a lot of reasons frowns on the STL. In fact they barely teach it. I understand some of their concerns, but at the same time the STL doesn't have cooties :D.