| 比赛 |
csp2025模拟练习1 |
评测结果 |
AAAWWWWWAAWWWWWWWAAWWWWWW |
| 题目名称 |
麻烦的键盘 |
最终得分 |
28 |
| 用户昵称 |
wdsjl |
运行时间 |
0.258 s |
| 代码语言 |
C++ |
内存使用 |
3.93 MiB |
| 提交时间 |
2025-10-28 09:09:34 |
显示代码纯文本
#include <bits/stdc++.h>
using namespace std;
const int N = 5e5+10;
int l1,l2,cnt1[30],cnt2[30],cha,mb1,mb2,cuo,cuodui;
char s1[N],s2[N],s3[N];
vector<int> q;
signed main(){
freopen("troublekey.in","r",stdin);
freopen("troublekey.out","w",stdout);
mb1=mb2=cuo=cuodui=-1;
cin>>(s1+1);
l1=strlen(s1+1);
for(int i=1;i<=l1;i++){
cnt1[s1[i]-'a']++;
}
cin>>(s2+1);
l2=strlen(s2+1);
for(int i=1;i<=l2;i++){
cnt2[s2[i]-'a']++;
}
cha=l1-l2;
for(int i=0;i<26;i++){
if(cnt1[i]!=0){
if(cnt2[i]==0){
if(cnt1[i]==cha)mb1=i;
else cuo=i;
// q.push_back(i);
}
}
if(cnt1[i]==0){
if(cnt2[i]!=0){
cuodui=i;
}
}
}
cout<<(char)(cuo+'a')<<" "<<(char)(cuodui+'a')<<endl;
if(cha)cout<<(char)(mb1+'a');
else cout<<'-';
return 0;
}