POJ -2503 Babelfish

//以后对于string就用cin和cout输入输出搞定//

AC代码:

#include<stdio.h>
#include<string>
#include<iostream>
using namespace std;
#include<map>
map<string,string>M;
int main()
{
    char a[30];
    char b[15];
    char c[15];
    char d[15];
    while(gets(a)&&a[0]!='\0')
    {
        sscanf(a,"%s %s",&b,&c);
        M[c]=b;
    }
    while(gets(d)&&d[0]!='\0')
    {
        if(M[d][0]=='\0')
            cout<<"eh\n";
        else
            cout<<M[d]<<endl;
    }
    return 0;
}

你可能感兴趣的:(POJ -2503 Babelfish)