var
key,st1:string;
a,b,i,j,k:integer;
keykey:array[1..100]of integer;
counta,countb:array[1..26,1..26]of char;
begin
assign(input,'vigenere.in');reset(input);
assign(output,'vigenere.out');rewrite(output);
readln(key);
read(st1);
//____________________________________________
for i:=1 to 26 do
for j:=1 to 26 do
begin
if (j-i+27)mod 26=0 then k:=26 else k:=(j-i+27)mod 26;
counta[i,j]:=chr(k+96);
end;
//____________________________________________
for i:=1 to 26 do
for j:=1 to 26 do
begin
if (j-i+27)mod 26=0 then k:=26 else k:=(j-i+27)mod 26;
countb[i,j]:=chr(k+64);
end;
//____________________________________________
a:=length(key);
b:=length(st1);
for i:=1 to a do if ord(key[i])>96 then keykey[i]:=ord(key[i])-96
else keykey[i]:=ord(key[i])-64;
//________________________________________________________________
k:=0;
for i:=1 to b do
begin
inc(k);
if k>a then k:=k mod a;
if ord(st1[i])>96 then st1[i]:=counta[keykey[k],ord(st1[i])-96]
else st1[i]:=countb[keykey[k],ord(st1[i])-64];
end;
//________________________________________________________________
write(st1);
close(input);
close(output);
end.