讨论 / Pascal AC
Heartbeat 2016-01-01 15:34:14
点我顶贴 收藏 删除
var s,x,y:ansistring; a:array['A'..'Z']of longint;

i:longint; j:char;

begin

readln(x);

readln(y);

readln(s);

for i:=1 to length(x) do inc(a[x[i]]);

for j:='A' to 'Z' do

if a[j]=0 then begin

write('Failed');

exit;

end;

fillchar(a,sizeof(a),0);

for i:=1 to length(y) do

begin

if a[y[i]]=0 then

a[y[i]]:=ord(x[i]);

if (a[y[i]]<>0)and(a[y[i]]<>ord(x[i])) then

begin

write('Failed');

exit;

end;

end;

fillchar(a,sizeof(a),0);

for i:=1 to length(x) do

begin

if a[x[i]]=0 then

a[x[i]]:=ord(y[i]);

if (a[x[i]]<>0)and(a[x[i]]<>ord(y[i])) then

begin

write('Failed');

exit;

end;

end;

for i:=1 to length(s) do

write(chr(a[s[i]]));

end.

查看更多回复
提交回复