标签:
1 #include<iostream> 2 #include<map> 3 #include<cstdio> 4 #include<algorithm> 5 #include<string> 6 #include<cstring> 7 using namespace std; 8 int main() 9 { 10 map<string,string>mp; 11 int i=0,j,k; 12 char s1[15],s2[15]; 13 char a[11]; 14 char ch; 15 char buf[15]; 16 // freopen("in.txt","r",stdin); 17 gets(a); 18 while(scanf("%s",s1)) 19 { 20 if(0==strcmp(s1,"END")) 21 break; 22 else 23 { 24 scanf("%s",s2); 25 mp[s2]=s1; 26 } 27 } 28 getchar(); 29 gets(a); 30 while(scanf("%c",&ch)==1) 31 { 32 if(isalpha(ch)) 33 { 34 buf[i++]=ch; 35 } 36 else 37 { 38 buf[i]=‘\0‘; 39 i=0; 40 if(strcmp(buf,"END")==0) 41 break; 42 if(mp.find(buf)!=mp.end()) 43 cout<<mp[buf]; 44 else 45 printf("%s",buf); 46 printf("%c",ch); 47 } 48 49 } 50 return 0; 51 }
标签:
原文地址:http://www.cnblogs.com/a1225234/p/4548858.html