var M,k:ansistring;
k2:array[1..1024]of integer;
N:array[1..1024]of char;
i,a:longint;
begin
assign(input,'vigenere.in');reset(input);
assign(output,'vigenere.out');rewrite(output);
readln(k);
readln(M);
for i:=1 to length(k) do
k2[i]:=ord(upcase(k[i]))-ord('A');
for i:=1 to length(M) do
if ord(M[i])<=ord('Z') then
begin
a:=ord(M[i])-k2[(i-1) mod length(k)+1];
if a<ord('A') then a:=a+26;
N[i]:=chr(a);
end
else begin
a:=ord(M[i])-k2[(i-1) mod length(k)+1];
if a<ord('a') then a:=a+26;
N[i]:=chr(a);
end;
for i:=1 to length(M) do
write(N[i]);
close(input);close(output);
end.