fork download
  1. #include <iostream>
  2. #include <map>
  3. #include <algorithm>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. int data[]={1, 2, 3, 4, 1, 2, 3, 4, 1, 1, 2, 5, 12, 5};
  9. map<int,unsigned> tb;
  10. for(size_t i=0;i<sizeof(data)/sizeof(*data);++i) ++tb[data[i]];
  11. for(map<int,unsigned>::iterator i=tb.begin();i!=tb.end();++i) if(i->second==2) cout<<i->first<<endl;
  12. return 0;
  13. }
Success #stdin #stdout 0s 3432KB
stdin
Standard input is empty
stdout
3
4
5