var
m,k:ansistring;
i,n,l:longint;
t:char;
begin
assign(input,'vigenere.in');
assign(output,'vigenere.out');
reset(input);
rewrite(output);
readln(k);
l:=length(k);
readln(m);
for i:=1 to l do if ord(k[i])<91 then k[i]:=chr(ord(k[i])+32);
for i:=1 to length(m) do
begin
n:=(n+1) mod length(k);
if n=0 then n:=length(k);
t:=chr(ord(m[i])-ord(k[n])+ord('a'));
if ((m[i]in['a'..'z'])=(t in['a'..'z']))and((m[i]in['A'..'Z'])=(t in['A'..'Z']))
then m[i]:=t
else m[i]:=chr(ord(t)+26);
end;
writeln(m);
close(input);
close(output);
end.