gogogo ohleohleohle
2023-12-27 21:43:15
发布于:广东
4阅读
0回复
0点赞
#include <iostream>
#include <cmath>
#include <cstring>
#include <algorithm>
using namespace std;
string a, b, c;
int a1[1000], b1[1000], c1[1000], word[1000], flag[1000];
int main(){
cin >> a >> b >> c;
if(a.length() < 26){
cout << "Failed";
return 0;
}
for(int i = 0; i < a.length(); i++){
if(flag[b[i]]){
if(flag[b[i]] == a[i]){
continue;
}else{
cout << "Failed";
return 0;
}
}
if((int)(word[a[i]])){
if((int)(word[a[i]]) == (int)(b[i])){
continue;
}else{
cout << "Failed";
return 0;
}
}else{
word[a[i]] = b[i];
flag[b[i]] = a[i];
}
}
string d;
for(int i = 0; i < c.length(); i++){
if(!word[c[i]]){
cout << "Failed";
return 0;
}else{
d += word[c[i]];
}
}
cout << d;
return 0;
}
这里空空如也
有帮助,赞一个