# Arup Guha
# 11/9/2025
# Solution to JK Contest #1 Problem: Key to Crypto

# Get cipher and key.
cipher = input().strip()
key = input().strip()

# Build plaintext here.
plain = ""
sz = len(key)

# First we go through the key notice the ciphertext could be shorter, so
# we have to use the minimum function so our program doesn't crash.
for i in range(min(len(cipher),len(key))):

    # This is the rule for the first len(key) letters...
    plainnum = (ord(cipher[i])- ord(key[i])+26)%26
    plainlet = chr(plainnum + ord('A'))
    plain = plain + plainlet

# This is for the rest.
for i in range(len(key), len(cipher)):

    # Here we use a different formula.
    plainnum = (ord(cipher[i]) - ord(plain[i-sz]) + 26)%26
    plainlet = chr(plainnum + ord('A'))
    plain = plain + plainlet

# Ta da!
print(plain)
