// UVa 484 - The Department of Redundancy Department #include <map> #include <iostream> #include <vector> using namespace std; int main() { int v; map<int, int> m; int n = 0; vector<int> o; while (cin >> v) { m[v]++; o.push_back(v); n++; } for (int i = 0; i < n; i++) if (m[o[i]] > 0) { cout << o[i] << " " << m[o[i]] << endl; m[o[i]] = 0; } return 0; }
No comments:
Post a Comment