社区讨论
20pts求助!
B3927[GESP202312 四级] 小杨的字典参与者 1已保存回复 0
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 0 条
- 当前快照
- 1 份
- 快照标识符
- @lul0hvs8
- 此快照首次捕获于
- 2024/04/04 17:05 2 年前
- 此快照最后确认于
- 2024/04/04 19:41 2 年前
CPP
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
map<string,string>a;
map<string,string>::iterator it;
ll n;
string s,t,aa;
signed main(){
cin>>n;
for(int i=1;i<=n;i++)
cin>>s>>t,a[s]=t;
cin>>aa;
string b="";
for(int i=0;i<aa.size();i++)
{
if(aa[i]<'a'||aa[i]>'z'){
it=a.find(b);
if(!b.empty()&&it==a.end())cout<<"UNK";
else if(!b.empty())cout<<it->second;
cout<<aa[i];
b="";
}
else b+=aa[i];
}
it=a.find(b);
if(it==a.end())cout<<"UNK";
else cout<<it->second;
return 0;
}
回复
共 0 条回复,欢迎继续交流。
正在加载回复...