P1071 潜伏者
恶心的小模拟
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<map>
using namespace std;
string a,b,c;
map <char,char> co1;
map<char,char > co2;
map<char,int> vis,v2;
int l;
int main(){
cin>>a>>b>>c;
l=a.length();
for(int i=0;i<l;++i){
if(!vis[b[i]]){
// vis[b[i]]=1;
if(v2[a[i]]!=0){
if(co1[a[i]]==b[i]){
continue;
}else
cout<<"Failed";
return 0;
}
v2[a[i]]=vis[b[i]]=1;
co1[a[i]]=b[i];
co2[b[i]]=a[i];
}else{
if(co1[a[i]]==b[i]){
continue;
}else{
cout<<"Failed";
return 0;
}
}
}
for(char i='A';i<='Z';++i){
if(!vis[i]){
cout<<"Failed";
return 0;
}
}
l=c.length();
for(int i=0;i<l;++i){
cout<<co1[c[i]];
}
return 0;
}