Friday, April 24, 2015

UVa - 10282 - Babelfish

#include <iostream>
#include <algorithm>
#include <sstream>
#include <map>
#include <vector>
using namespace std;

int main(){
    int t, n;
    string first, second, input, word;
    map <string, string> diction;
    while(getline(cin, input) && input.size()){
        stringstream io;
        io << input;
        io >> first >> second;
        diction[second] = first;
    }
    while(cin >> word){
        if(diction.count(word))cout << diction[word] << endl;
        else cout << "eh" << endl;
    }

    return 0;
}

No comments:

Post a Comment