题解 | #字符串加密#

字符串加密

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)

全部评论

相关推荐

点赞 评论 收藏
分享
05-27 14:57
西北大学 golang
强大的社畜在走神:27届真不用急,可以搞点项目、竞赛再沉淀沉淀,我大二的时候还在天天打游戏呢
投递华为等公司10个岗位
点赞 评论 收藏
分享
白火同学:能。我当初应届沟通了1200,收简历50,面试10左右吧,加油投吧
投了多少份简历才上岸
点赞 评论 收藏
分享
身边有人上海、深圳 6、7k 都去了,真就带薪上班了。
程序员小白条:木的办法, 以后越来越差,还是家附近宅着吧,毕业的人越来越多,岗位都提供不出来,经济又过了人口红利期
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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