1 条题解
-
0
#include <bits/stdc++.h> using namespace std; string s,t; map<string,string> m; int main() { int n; cin>>n; string c1,c2; while(n--) { cin>>c1>>c2; m[c1] =c2; } // for(auto i:m) // { // cout<<i.first<<' '<<i.second<<endl; // } cin>>s; s += ' ';//作用是将最后一个单词也统一处理 for(char i:s) { if(islower(i)) { t += i; } else { //应对连续标点的出现 不会出现多余的UNK if(t != "") { //先查找a的内容是否存在 int p = m.count(t); if(p > 0){ cout<<m[t]; }else { cout<<"UNK"; } t = ""; } cout<<i; } } return 0; }
信息
- ID
- 4943
- 时间
- 1000ms
- 内存
- 512MiB
- 难度
- 2
- 标签
- 递交数
- 14
- 已通过
- 5
- 上传者