题解 | 凯撒加密

凯撒加密

https://www.nowcoder.com/practice/006b7917d3784371a43cfbae01a9313d

import sys
import string
n = 0
list1 = []
list2 = list(string.ascii_lowercase)
# print(len(list2))
for line in sys.stdin:
    a = line.split()
    if n == 0:
        n = int(a[0])
        continue
    string1 = a[0]
    for i in string1:
        st_index = list2.index(i)
        run = (st_index + n) % 26
        print(list2[run],end='')

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

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