#include <bits/stdc++.h>
using namespace std;
char s1[30], s2[30], s[2333];
struct node {
  char c;
  int id;
} arr[30];
int n, m, a;
bool cmp(node a, node b) { return a.c < b.c; }
int main() {
  scanf("%s", s1);
  for (int i = 0; i < 26; i++) {
    arr[i].c = s1[i];
    arr[i].id = i;
  }
  sort(arr, arr + 26, cmp);
  scanf("%s", s2);
  scanf("%s", s);
  int len = strlen(s);
  for (int i = 0; i < len; i++) {
    bool flag = 0;
    char ch;
    if (s[i] >= 'A' && s[i] <= 'Z') {
      ch = s[i] + 32;
      flag = 1;
    } else if (s[i] >= 'a' && s[i] <= 'z')
      ch = s[i];
    else {
      printf("%c", s[i]);
      continue;
    }
    char cc = s2[arr[ch - 'a'].id];
    if (flag)
      printf("%c", cc - 32);
    else
      printf("%c", cc);
  }
  printf("\n");
  return 0;
}
