hdu 1075 What Are You Talking About
2015-03-08 11:13
351 查看
#include <iostream> #include <cstdio> #include <string> #include <map> using namespace std; int main() { map<string, string>th; string a, b; string::size_type i, len; map<string, string>::iterator ite; getline(cin, a); th.clear(); while(1){ cin>>a; if(a!="END"){ cin>>b; th[b] = a; } else break; } /*for(ite=th.begin(); ite!=th.end(); ite++) cout<<ite->first<<' '<<ite->second<<endl;*/ getline(cin, a); getline(cin, a); while(1) { getline(cin, a); b.clear(); if(a!="END") { len = a.size(); for(i=0; i<len; i++) { if( isalpha(a[i]) ) b += a[i]; else{ if( b.empty()!=true ) { if( th.count(b)!=0 ) cout<<th[b]<<a[i]; else cout<<b<<a[i]; //注意输出a[i]; b.clear(); //注意清空b } else cout<<a[i]; } } printf("\n"); } else break; } return 0; }
相关文章推荐
- HDU 1075 What Are You Talking About
- HDU 1075 What Are You Talking About
- HDU 1075 What Are You Talking About
- hdu 1075 What Are You Talking About(字典树)
- HDU 1075 What Are You Talking About
- HDU1075 What Are You Talking About
- HDU 1075 What Are You Talking About (STL, 字典树)
- HDU 1075 What Are You Talking About(Tire树)
- HDU 1075 - What Are You Talking About
- HDU-1075 What Are You Talking About
- hdu 1075 What Are You Talking About< map<string,string> >
- HDU 1075 What Are You Talking About (字典树)
- [字典树] HDU 1075 - What Are You Talking About
- hdu 1075-What Are You Talking About(Map&&字典树)
- hdu acm 1075 What Are You Talking About
- hdu 1075 What Are You Talking About(字典树)
- HDU 1075 What Are You Talking About 【map + find】
- What Are You Talking About hdu1075
- HDU-1075-What Are You Talking About
- hdu 1075 What Are You Talking About