#include<bits/stdc++.h>
using namespace std;
class num{
public:
char after, before;
};
num s[101];
int main(){
int n=0,flag=0;
string a,b,c;
cin >>a>>b>>c;
if(a.size()!=b.size()||b.size()<26){
cout<<"Failed";
return 0;
}
else{
for(int i=0;i<a.size();i++){
flag=0;
for(int j=0;j<n;j++){
if(a[i]==s[j].after){
if (b[i]==s[j].before)
flag=1;
else{
cout << "Failed";
return 0;
}
}
if(b[i]==s[j].before)
if(a[i] != s[j].after){
cout<<"Failed";
return 0;
}
}
if(!flag){
s[n].after=a[i];
s[n++].before=b[i];
}
}
}
if(n==26){
for(int i=0;i<c.size();i++){
for(int j=0;j<n;j++){
if(c[i]==s[j].after)
cout<<s[j].before;
}
}
}
else
cout<<"Failed";
return 0;
}
潜伏者 oj.top
于 2023-07-03 17:32:34 首次发布