while True: try: word = input().upper() s = input() alpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' # 字母表 n_word = '' # 融入加密词后的新字母表 res = '' for i in word: if i not in n_word: # 加密单词剔除重复字母 n_word += i for i in alpha: if i not in n_word and len(n_word) <= 26: # 用字母表剔除已有字母后补齐为26个新字母表n_word n_word += i for i in s: if i in alpha: # 说明i是大写字母,因为alpha字母表默认值是大写字母 res += n_word[alpha.index(i)] # 索引值相同,根据字母表索引值在新字母表中取值后追加给返回结果 else: # i为小写字母 res += n_word[alpha.index(i.upper())].lower() # 将小写字母转换为大写字母取索引值后,追加返回结果之前将字母还原为小写字母 print(res) except: break