#include<bits/stdc++.h>
using namespace std;
char m[1005],k[105],a,c[105];
int miyao(int u){
if(k[u]==0) miyao(u-strlen(k));
else return k[u];
}
int main(){
cin>>k>>m;
int t,f;
bool flag;
for(int i=0;i<strlen(m);i++){
t=m[i];
f=miyao(i);
if(t<=90) flag=true;
else flag=false;
if(f>=97) f=f-96;
else f=f-64;
t=t-f+1;
if(flag==true&&t<65) t=t+26;
if(flag==false&&t<97) t=t+26;
c[i]=t;
}
cout<<c<<endl;
return 0;
}