#include<stdio.h>
#include<string.h>
#include<string>
#include<iostream>
#include<algorithm>
#include<map>
using namespace std;
map<string,string>mymap;
int main() {
int i,j,k,n,m;
char s[4000],str[30],str2[30];
string str1;
scanf("%s",str);
while(scanf("%s",str),strcmp(str,"END")) {
scanf("%s",str2);
mymap[str2]=str;
}
getchar();
gets(s);
while(gets(s),strcmp(s,"END")) {
k=0;
for(i=0;s[i];i++)
if(s[i]>='a'&&s[i]<='z')
str[k++]=s[i];
else {
if(k==0) {
printf("%c",s[i]);
continue;
}
str[k++]=0;
str1=mymap[str];
strcpy(str2,str1.c_str());//或者直接进行长度比较str1.length();
if(strlen(str2)==0)
printf("%s",str);
else
cout<<str1;
printf("%c",s[i]);
k=0;
}
printf("\n");
}
return 0;
}
#include<string.h>
#include<string>
#include<iostream>
#include<algorithm>
#include<map>
using namespace std;
map<string,string>mymap;
int main() {
int i,j,k,n,m;
char s[4000],str[30],str2[30];
string str1;
scanf("%s",str);
while(scanf("%s",str),strcmp(str,"END")) {
scanf("%s",str2);
mymap[str2]=str;
}
getchar();
gets(s);
while(gets(s),strcmp(s,"END")) {
k=0;
for(i=0;s[i];i++)
if(s[i]>='a'&&s[i]<='z')
str[k++]=s[i];
else {
if(k==0) {
printf("%c",s[i]);
continue;
}
str[k++]=0;
str1=mymap[str];
strcpy(str2,str1.c_str());//或者直接进行长度比较str1.length();
if(strlen(str2)==0)
printf("%s",str);
else
cout<<str1;
printf("%c",s[i]);
k=0;
}
printf("\n");
}
return 0;
}