Uva 10282 Solution

#include<bits/stdc++.h>
using namespace std;
int main()
{
    string a, b, t;
    map<string, string>st;

    while(getline(cin, t))
    {
        if(t == "")
            break;
        stringstream s(t);
        s >> a >> b;
        st[b] = a;
    }

    while(cin >> t)
    {
        if(!st[t].empty())
            cout << st[t] << endl;
        else
            cout << "eh" << endl;
    }

    return 0;
}

Comments