problem
solution
codes
#include<iostream>
#include<string>
#include<map>
using namespace std;
map<char,char>ma, mm;
string ans;
int main(){
bool flag = true;
string a, b;
//先加密信息,再原始信息,后面对应的时候是扫描原始信息的
cin>>a>>b;
for(int i = 0; i < b.size(); i++){
if(ma.count(b[i])){
if(ma[b[i]]==a[i])continue;
else { flag = false; break;}
}
ma[b[i]] = a[i];//原始信息对应的加密信息
mm[a[i]] = b[i];//加密信息对应的原始信息
}
string s; cin>>s;
for(int i = 0; i < s.size(); i++){
if(ma.count(s[i]))ans += mm[s[i]];
else { flag = false; break;}
}
for(int i = 0; i < 26; i++){
if(!ma.count('A'+i)){
flag = false; break;
}
}
if(!flag)cout<<"Failed\n";
else cout<<ans<<"\n";
return 0;
}
标签:count,Vijos1752,ma,int,NOIP2009,信息,flag,潜伏,false
From: https://blog.51cto.com/gwj1314/6043787