题解 | #字符串加密#
字符串加密
https://www.nowcoder.com/practice/e4af1fe682b54459b2a211df91a91cf3
import sys
alphabet = 'abcdefghijklmnopqrstuvwxyz'
new_alphabet_in = input()
information = input()
encrypted_information = ''
#先进行去重工作
set_new_alphabet = set()
new_alphabet = ''
for i in new_alphabet_in:
if i not in set_new_alphabet:
set_new_alphabet.add(i)
new_alphabet += i
#去重之后补齐,用字母表中剩余的字母填充完整
for i in alphabet:
if i not in new_alphabet:
new_alphabet += i
#进行加密工作
for i in information:
encrypted_information += new_alphabet[alphabet.index(i)]
print(encrypted_information)
