题解 | 字符串加密

s1=input()
s=list(s1)
list1=[]
for i in s:
    if i not in list1:
        list1.append(i)
length1=len(list1)
xunhuan=26-length1
alpha1='abcdefghijklmnopqrstuvwxyz'
alpha1=list(alpha1)
for zimu in range(26):
    if alpha1[zimu] not in list1:
        list1.append(alpha1[zimu])


# list1='trailbzescdfghjkmnopquvwxy'
# alpha1='abcdefghijklmnopqrstuvwxyz'
# list1=list(list1)
# alpha1=list(alpha1)

b1=input()#attackatdawn
b=list(b1)
b_result=[]
for number in b:
    for alpha_number in range(26):
        if number==alpha1[alpha_number]:
            b_result.append(list1[alpha_number])
print("".join(b_result))
字符串转列表list()

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务