Uva 484 Solution

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int s;
    map<int, int>mp;
    vector<int>v;
    while(cin >> s)
    {
        if(mp[s] == 0)
            v.push_back(s);
        mp[s] += 1;
    }
    for(int i=0;i<v.size();i++)
        cout << v[i] << " " << mp[v[i]] << "\n";
    return 0;
}

Comments