Each time you find a number, add one to that value's count in the map (or, if it's te first time you've seen it, create its count in the map, with value 1).
Then go through the map, and output every number for which the count is more than one.
I didn't know that something like map<..> existed, thanks.
I hoped there is maybe an easier way with for loops and conditions to achieve this, but this map<> thing seems more clear.