#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
using namespace std;
char keys[30];
int main(void){
int i, j;
char tmp;
while (scanf("%s", keys) != EOF){
getchar();
while ((tmp = getchar()) != '\n'){
if (tmp >= 'a' && tmp <= 'z'){
putchar(keys[tmp - 'a']);
}
else if (tmp >= 'A' && tmp <= 'Z'){
putchar((keys[tmp - 'A'] - 32));
}
else{
putchar(tmp);
}
}
//putchar(tmp);
}
system("pause");
return 0;
}