题解 | #字符串加密#

字符串加密

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

src = di_chr = 'a b c d e f g h i j k l m n o p q r s t u v w x y z'.split(' ')
dst = 'a b c d e f g h i j k l m n o p q r s t u v w x y z'.split(' ')
paswd, instr = input(), list(input())
keyquchong = list(set(paswd))
keyquchong.sort(key=paswd.index)
while keyquchong:
    di_chr.insert(0, keyquchong.pop())
di_chr = list(set(di_chr))
di_chr.sort(key=src.index)
for c in instr:
    print(di_chr[dst.index(c)],end="")

全部评论

相关推荐

10-02 19:29
已编辑
浙江科技大学 运营
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务