#include <stdio.h>
#include<string.h>
int main() {
    char s1[101] = { 0 };
    gets(s1);
    int len = strlen(s1);
    s1[len] = 'a';
    int i = 0;
    int j = 1;
    for (i = len + 1; i < len + 26; i++) {
        s1[i] = 'a' + (j++);
    }
    s1[i] = '\0';
    int len1 = strlen(s1);
    for (int i = 0; i < len1; i++) {
        for (int j = i + 1; j < len1; j++) {
            if (s1[i] == s1[j]) {
                for (int k = j + 1; k < len1; k++)
                    s1[k - 1] = s1[k];
                j--;
                len1--;
            }
        }
    }
    s1[len1] = '\0';
    char s2[101] = { 0 };
    gets(s2);
    int l = 0;
    int n = strlen(s2);
    for (int l = 0; l < n; l++) {
        if (s2[l] >= 'a' && s2[l] <= 'z') {
            s2[l] = s1[s2[l] - 'a'];
            printf("%c", s2[l]);
        } else {
            s2[l] = s1[s2[l] + 32 - 'a'] - 'a';
            printf("%c", s2[l]);
        }
    }
    return 0;
}