EQSTR - Biến đổi chuỗi
Tác giả: ladpro98
Ngôn ngữ: Pascal
program eqstr;
uses math;
const fi='';
var s,t,typ,res:string;
inp:text;
procedure process;
var i,x,y:longint;
begin
res:=s;
for i:=1 to length(s) do
begin
x:=abs(ord(s[i])-ord(t[i]));
y:= (min(ord(s[i]),ord(t[i])) + ord('z')-max(ord(s[i]),ord(t[i]))-ord('a'));
if x<y then
begin
res[i]:=chr(min(ord(s[i]),ord(t[i])));
end
else
res[i]:='a';
end;
end;
begin
assign(inp,fi);
reset(inp);
while not (typ = '[END]') do
begin
readln(inp,typ);
if typ = '[END]' then break;
readln(inp,s);
readln(inp,t);
readln(inp);
process;
writeln(res);
end;
end.