#include <iostream>
#include <cstdio>
#include <cstring>
#include <map>
#include <string>
#include <algorithm>
using namespace std;
string s1;
string s2;
int judge(char ch)
{
if(ch >= 'a' && ch <= 'z')
return 1;
else
return 0;
}
int main()
{
map<string, string>m;
while(cin>>s1)
{
if(s1 == "START")
continue;
if(s1 == "END")
break;
cin>>s2;
m[s2] = s1;
}
getchar();
map<string, string>::iterator it;
while(getline(cin,s1))
{
if(s1 == "START")
continue;
if(s1 == "END")
break;
int len = s1.length();
string s3 = "";
for(int i = 0; i < len; i++)
{
if(judge(s1[i]))
{
s3 += s1[i];
}
else
{
it = m.find(s3);
if(it != m.end())
cout<<m[s3];
else
cout<<s3;
s3 = "";
cout<<s1[i];
}
}
printf("\n");
}
return 0;
}
hdu 1075
最新推荐文章于 2018-08-21 21:23:00 发布