题解 | #字符串加密#

字符串加密

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

while True:
    try:
        key = input()
        word = input()
        stack = []
        for c in key:
            if c not in stack:
                stack.append(c)
        for i in range(ord('a'), ord('z') + 1):
            if chr(i) not in stack:
                stack.append(chr(i))
        res = ''
        for i in word:
            id = ord(i) - ord('a')
            res += stack[id]
        print(res)

    except:
        break

全部评论

相关推荐

09-01 16:09
门头沟学院 Java
点赞 评论 收藏
分享
迷茫的大四🐶:价格这么低都能满了?
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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