#include <iostream>
#include <string>
using namespace std;
int main() {
string b, c;
getline(cin, b);
getline(cin, c);
for(int i = 0; i < b.length(); i++) {
cout << (b[i] - 'A' < 0? ' ': c[b[i] - 'A']);
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RyaW5nPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7CglzdHJpbmcgYiwgYzsKCWdldGxpbmUoY2luLCBiKTsKCWdldGxpbmUoY2luLCBjKTsKCWZvcihpbnQgaSA9IDA7IGkgPCBiLmxlbmd0aCgpOyBpKyspIHsKCQljb3V0IDw8IChiW2ldIC0gJ0EnIDwgMD8gJyAnOiBjW2JbaV0gLSAnQSddKTsKCX0KCXJldHVybiAwOwp9