题解:AT_scpc2026_div3_a Find the Missing Letter
ElysiaTruE · · 题解
在输入一个字符串 SCSC 时,不小心漏掉了一个字符,找出漏掉的字符。
我们发现 SCSC 这个字符串,恰好有两个 S,两个 C。于是,在字符串中,哪个字母只出现了一次,哪个字母就是少了一个的字母。
:::info[代码]
#include<bits/stdc++.h>
using namespace std;
int main(){
int a=0,b=0;
string s;
cin>>s;
for(auto c:s){
if(c=='S')a++;
else if(c=='C')b++;
else puts("轻松绷住");
}
if(a==1)cout<<"S";
else if(b==1)cout<<"C";
else puts("轻松绷住");
return 67^67;
}
:::