```pascal
var f:array ['A'..'Z'] of char;
ff:array ['A'..'Z'] of boolean;
a,b,c:string;
i,n:longint;
ti:char;
procedure error;
begin
writeln('Failed');
halt;
end;
begin
fillchar(ff,sizeof(ff),0);
readln(a);
readln(b);
readln(c);
n:=ord(a[0]);
for ti:='A' to 'Z' do f[ti]:='0';
for i:=1 to n do
if ((f[a[i]]<>'0') and (f[a[i]]<>b[i])) or ((ff[b[i]]) and (f[a[i]]<>b[i])) then error
else
begin
f[a[i]]:=b[i];
ff[b[i]]:=true;
end;
for ti:='A' to 'Z' do
if f[ti]='0' then error;
for i:=1 to ord(c[0]) do write(f[c[i]]);
end.
```
by huangzhewer @ 2018-11-16 20:49:00
这个题。。没什么好说的吧。
by huangzhewer @ 2018-11-16 20:49:22
@[huangzhewer](/space/show?uid=12581) $Emm$,C++
```cpp
#include<bits/stdc++.h>
using namespace std;
int main(){
map<char,char> mp;
string st1,st2;
cin>>st1>>st2;
for(unsigned int i = 0;i < st1.length();i++){
char x = st1[i],y = st2[i];
if(mp[x] != '\0'&&mp[x] != y){
cout<<"Failed"<<endl;
return 0;
}
mp[x] = y;
}
if(mp.size() < 26){
cout<<"Failed"<<endl;
return 0;
}
cin>>st1;
for(unsigned int i = 0;i < st1.length();i++){
cout<<mp[st1[i]];
}
cout<<endl;
return 0;
}
```
by 加载错误 @ 2018-11-16 21:31:06
嗯。我也会c++,看一下啊
by huangzhewer @ 2018-11-16 21:32:36
```cpp
#include <bits/stdc++.h>
using namespace std;
char a[10000],b[10000],c[10000];
map <char,char> ma;
map <char,char> yu;
int main()
{
scanf("%s %s",a,b);
scanf("%s",c);
int len=strlen(a);
for (int i=0; i<len; i++)
{
if (!ma[b[i]])
{
ma[b[i]]=a[i];
if (!yu[a[i]]) yu[a[i]]=b[i];
else
{
cout<<"Failed";
return 0;
}
}
else {
if (ma[b[i]]!=a[i])
{
cout<<"Failed";
return 0;
}
}
}
for (char i='A';i<='Z';i++)
{
if (!ma[i])
{
cout<<"Failed";
return 0;
}
}
for (int i=0;i<strlen(c);i++)
{
printf("%c",yu[c[i]]);
}
return 0;
}
```
by huangzhewer @ 2018-11-16 21:39:48
# @[huangzhewer](/space/show?uid=12581) Thanks,dalao.
by 加载错误 @ 2018-11-16 21:46:47
# @[huangzhewer](/space/show?uid=12581) 我只是觉得这个输入应该输出$HIJACK$
by 加载错误 @ 2018-11-16 21:53:33
嗯,多看看题目吧
by huangzhewer @ 2018-11-17 09:26:05
@[加载错误](/space/show?uid=35971) 这个数据中 “N” 被用了两次
by 曾宇康 @ 2019-01-11 11:47:18
我也觉得HIJACK没毛病。。。
by 未远— @ 2019-01-26 19:24:24