#include <iostream>
#include <map>
#include <string>
#include <cctype>
#include <cstdio>
using namespace std;
typedef map<string,string> Mss;
Mss mss;
int main()
{
string s;
cin>>s;
while(1)
{
cin>>s;
if(s==string("END"))break;
string key;
cin>>key;
mss[key]=s;
}
cin>>s;
getchar();
/*
* you may ask what getchar() does here
* cin ignores tab('\t') enter('\n') space(' '),
* ignoring doesn't mean discarding,the char '\n' is still in the buffer
*/
while(1)
{
getline(cin,s);
if(s==string("END"))break;
string key;
size_t i=0;
for(;i<s.size();++i)
{
if(isalpha(s[i]))
{
key.push_back(s[i]);
}
else
{
if(!key.empty())
{
Mss::iterator it=mss.find(key);
if(it==mss.end())cout<<key;
else cout<<it->second;
}
key.clear();
cout<<s[i];
}
}
cout<<endl;
}
return 0;
}
杭电 acm 1075 What Are You Talking About
最新推荐文章于 2022-02-28 03:02:01 发布