题解 | #字符串加密#

字符串加密

https://www.nowcoder.com/practice/e4af1fe682b54459b2a211df91a91cf3

import sys
KEY = input()
chars = input()
CHARs = []
list1 = [chr(i) for i in range(ord('a'), ord('z')+1)]
head = []
dic = {}
for i in range(len(KEY)):
    if KEY[i] not in head:
        head.append(KEY[i])

for i in range(len(list1)):
    if list1[i] not in head:
        head.append(list1[i])

for i, j in zip(list1, head):
    dic[i] =j

for i in chars:
    CHARs.append(dic[i])

print("".join(CHARs))












全部评论

相关推荐

双非坐过牢:非佬,可以啊10.28笔试,11.06评估11.11,11.12两面,11.19oc➕offer
点赞 评论 收藏
分享
评论
点赞
收藏
分享
牛客网
牛客企业服务