题解 | 字符串加密

字符串加密

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

import string

s = input()
t = input()
striped_s = []
alphabet = {c: False for c in string.ascii_lowercase}
for c in s:
    if alphabet[c] == False:
        alphabet[c] = True
        striped_s.append(c)
for c in string.ascii_lowercase:
    if alphabet[c] == False:
        striped_s.append(c)
striped_s = "".join(striped_s)
print(t.translate(str.maketrans(string.ascii_lowercase, striped_s)))

全部评论

相关推荐

11-17 23:00
南昌大学 Java
我要娶个什么名:10元一天 0元提成😂
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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