AcWing 1345. 序号命名
原题链接
中等
作者:
小小瓷丁
,
2021-03-15 19:14:19
,
所有人可见
,
阅读 329
#include<iostream>
#include<string>
using namespace std;
char a[] = " ABCDEFGHIJKLMNOPRSTUVWXY";
string b;
bool judge(string s){
if(b.length()!=s.length()){
return false;
}
for(int i=0;i<b.length();i++){
int m = ((b[i]-'0')-1)*3;
if(s[i]!=a[m]&&s[i]!=a[m-1]&&s[i]!=a[m-2]){
return false;
}
}
return true;
}
int main(){
cin>>b;
string s;
int ans = 0;
while(cin>>s){
if(judge(s)){
cout<<s<<endl;
ans++;
}
}
if(ans==0) cout<<"NONE";
return 0;
}