标签:
map 写了一遍,表示基本功非常不扎实。
1 #include <iostream> 2 #include <string> 3 #include <map> 4 using namespace std; 5 map<string,string> mp; 6 string s,s2; 7 char c; 8 int cnt; 9 int main() 10 { 11 cnt=0; 12 while(cin>>s) 13 { 14 if(s=="START") continue; 15 if(s=="END") break; 16 cin>>s2; 17 mp[s2]=s; 18 } 19 cin>>s; 20 s.clear(); 21 scanf("%c",&c); 22 while((c=getchar())!=EOF) 23 { 24 if(isalpha(c)) 25 { 26 s+=c; 27 } 28 else { 29 if(s=="END") break; 30 if(mp.find(s)!=mp.end()) 31 { 32 cout<<mp[s]; 33 s.clear(); 34 } else{ 35 cout<<s; 36 s.clear(); 37 } 38 cout<<c; 39 } 40 } 41 }
HDU 1075 - What Are You Talking About
标签:
原文地址:http://www.cnblogs.com/nicetomeetu/p/5548007.html