水过水过....
<span style="font-size:18px;">var
l2,i,l,j:longint;
m:array[1..1010] of char;
kl:array[0..110] of longint;
cl:array[0..1010] of longint;
k,c:ansistring;
ch:char;
begin
readln(k);
readln(c);
l2:=length(k);
for i:=1 to l2 do
if ord(k[i])<95 then kl[i]:=ord(k[i])-64 else kl[i]:=ord(k[i])-96;
l:=length(c);
for i:=1 to l do
if ord(c[i])<95 then cl[i]:=ord(c[i])-64 else cl[i]:=ord(c[i])-96;
for i:=1 to l do
begin
if (i<=l2) then j:=i else j:=i mod l2;
if j=0 then j:=l2;
if (kl[j]<=cl[i]) then
begin
if ord(c[i])<95 then m[i]:=chr(65+cl[i]-kl[j])
else m[i]:=chr(96+cl[i]-kl[j]+1);
end else
begin
if ord(c[i])<95 then m[i]:=chr(64+27-kl[j]+cl[i])
else m[i]:=chr(96+27-kl[j]+cl[i]);
end;
end;
for i:=1 to l do write(m[i]);writeln;
end.
</span>
——by Eirlys