题解 | 字符串加密

字符串加密

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

#include <bits/stdc++.h>
using namespace std;

int main() {
    string s, t;
    cin >> s >> t;
    map<char, bool> ma;
    string res;
    for (auto x: s) 
        if (!ma[x]) {
            ma[x] = true;
            res += x;
        }
    for (int i = 0; i < 26; i++) if (!ma[i + 'a']) res += i + 'a';
    for (auto x: t) cout << res[x - 'a']; 
}

全部评论

相关推荐

努力的小明a:项目看着很眼熟,施磊老师吧,我也学的这个😋我当时是把rpc框架做成了一个分布式网盘,这是一个项目,然后muduo库做成集群即时通讯,又用QT做了个交互的客户端,这样又一个项目,然后一个轻量redis,一个CAD,总共四个项目,投了三个月就今天2月份一个小厂Qt offer,然后后面想开了,Qt啥的都能干,这个月get了个北京大厂的offer,做java后端,人生就是这么魔幻,现在就在去北京入职的路上
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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