讨论 / AC100(潜伏者)
Angel_Virus 2016-10-31 04:30:12
点我顶贴 收藏 删除
var s1,s2,t:string;

i,l1,l2:integer;

a:array[65..90] of string;

c,c1:array[65..90] of boolean;

begin

for i:=65 to 90 do a[i]:='';

readln(s1);l1:=length(s1);

readln(s2);

readln(t);l2:=length(t);

if l1<26 then begin

writeln('Failed');

exit;

end;

for i:=1 to l1 do begin

if (c[ord(s1[i])]=false) and (c1[ord(s2[i])]=false) then begin

a[ord(s1[i])]:=s2[i];

c[ord(s1[i])]:=true;

c1[ord(s2[i])]:=true;

end else if s2[i]<>a[ord(s1[i])] then begin

writeln('Failed');

exit;

end;

end;

for i:=1 to l2 do if a[ord(t[i])]='' then begin

writeln('Failed');

exit;

end;

for i:=1 to l2 do begin

write(a[ord(t[i])]);

end;

end.

查看更多回复
提交回复