题解 | #字符串加密#

字符串加密

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

# 大写小写都加上去了
i1 = input()
i2 = input()

lMap = [chr(ord("a")+i) for i in range(26) ]
cMap = [chr(ord("A")+i) for i in range(26) ]
lList = []
cList = []
for i in i1:
    if i in lMap:
        lList.append(i)
        lMap.remove(i)
    elif i in cMap:
        cMap.remove(i)
        cList.append(i)

lList += lMap
cList += cMap
outChar = ""
for i in i2:
    if i in lList:
        outChar += lList[ord(i) - ord("a")]
    elif i in cList:
        outChar += cList[ord(i) - ord("A")]
    else:
        outChar += i
print(outChar)

全部评论

相关推荐

来!
G了的牛可乐很爱吃烤...:百度面试官 给我说, 十月后开奖,现在都在泡池子
点赞 评论 收藏
分享
08-01 19:22
已编辑
前台
点赞 评论 收藏
分享
09-01 10:50
已编辑
东华大学 C++
PDD校招_内推:拼多多意向和开奖一般都比较晚,可能10月11月才出意向
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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