02 July 2015

UVA 10282 - Babelfish (MAP)

/***
Md. Namzul Hasan
Shahjalal University of Science & technology,sylhet.
hasan08sust@gmail.com
verdict: accepted
***/

#include<iostream>
#include<cstdio>
#include<cstring>
#include<stack>
#include<queue>
#include<algorithm>
#include<vector>
#include<cmath>
#include<cctype>
#include<sstream>
#include<stdlib.h>
#include<map>
using namespace std ;
typedef long long ll ;
typedef int in ;
typedef unsigned long long ull ;
const double pi = 2*acos(0) ;
#define maxi 40000
#define pf printf
#define sc scanf
#define pb push_back
#define MEM(x,y) (memset((x),(y),sizeof(x)))
#define MIN(x,y) ((x) < (y) ? (x) : (y))
#define MAX(x,y) ((x) > (y) ? (x) : (y))

string a,b,str ,s;
map <string, string> mp ;

int main()
{
    while(1)
    {
        getline(cin,s) ;
       if(s=="")
            break ;
            istringstream cs(s) ;
        cs>>a>>b ;
        mp[b] = a ;
    }

    while(cin>>a)
    {
        if(mp.find(a)!=mp.end())
        {
            cout<<mp[a]<<endl ;
        }
        else
            pf("eh\n") ;
    }
    return 0 ;
}

No comments:

Post a Comment

UVA 10679 - I Love Strings!!