题解 | 字符串加密

import sys
dict0=[]
for i in range(ord('a'),ord('z')+1):
            dict0.append(chr(i))
while True:
    try:
        key,string,chars,res=input(),input(),[],""
        for i in key:
            if i not in chars:
                chars.append(i)
        chars=list(map(lambda c:c.lower(),chars))
        dict1=dict0.copy()
        for i in chars:
            dict0.remove(i)
        key0=chars+dict0
        
        for i in string:
            res=res+key0[dict1.index(i)]
        print(res)
    except:
        break



        

全部评论

相关推荐

京东方 工艺开发 底薪1w,年终奖未知,可能有加班费拿满两千多 硕士
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务