hdu 1075
2013-10-27 11:58
134 查看
#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 What Are You Talking About 字典树 trie
- HDU - 1075 What Are You Talking About(字典树)
- hdu 1075 字典树
- hdu 1075 What Are You Talking About (字典树)
- hdu 1075 What Are You Talking Abou
- hdu 1075 map
- HDU 1075 what are you talking about?
- hdu 1075
- HDU 1075 字典树
- hdu 1075 What Are You Talking About(HashMap水过,可用字典树)
- hdu 1075(hash)
- HDU 1075 What Are You Talking About
- hdu 1075
- hdu 1075 What Are You Talking About
- HDU 1075 What Are You Talking About
- HDU 1075 What Are You Talking About(map运用)
- HDOJ/HDU 1075 What Are You Talking About(字符串查找翻译~Map)
- hdu 1075 What Are You Talking About
- hdu 1075 What Are You Talking About(字典树)
- hdu 1075 map