题解 | #字符串加密#

字符串加密

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))












全部评论

相关推荐

程序员猪皮:看不到八股什么意思
点赞 评论 收藏
分享
冷艳的小师弟在看机会:jd测评乱点直接被挂了,哭死~
点赞 评论 收藏
分享
评论
点赞
收藏
分享
牛客网
牛客企业服务