big = [chr(i) for i in range(65,91)]#所有大写字母
small =  [chr(i) for i in range(97,123)]#所有小写字母

while True:
    try:
        key = input()
        str = input()
    except:
        break
    else:
        password_dict = {} 
        password_list = []
        key = key.upper()
        for i in key:
            if i not in password_list:
                password_list.append(i)
        for i in big:
            if i not in password_list:
                password_list.append(i)
        password_list_small = [x.lower() for x in password_list]
        for i in range(26):
            password_dict[big[i]] = password_list[i]
            password_dict[small[i]] = password_list_small[i]
        for i in str:
            print(password_dict[i],end='')
        print()