program vigenere;
var
k,c:array[1..1001] of longint;
p,q,i,j:longint;
n:char;
begin
assign(input,'vigenere.in');
reset(input);
p:=0;
q:=0;
while not eoln(input) do
begin
inc(p);
read(n);
k[p]:=ord(upcase(n))-65;
end;
readln;
while not eoln(input) do
begin
inc(q);
read(n);
c[q]:=ord(n)-65;
end;
close(input);
assign(output,'vigenere.out');
rewrite(output);
for i:=1 to q do
begin
if (c[i] in [0..25]) then
c[i]:=(c[i]-k[(i-1) mod p+1]+26) mod 26
else
c[i]:=(c[i]-k[(i-1) mod p+1]+20) mod 26+32;
write(chr(c[i]+65));
end;
writeln;
close(output);
end.