题解 | #简单密码#

简单密码

https://www.nowcoder.com/practice/7960b5038a2142a18e27e4c733855dac

#include <iostream>
#include <string>
using namespace std;

string Secure(string s){
    string str;
    char arr[] = {"22233344455566677778889999"};
    char brr[] = {"bcdefghijklmnopqrstuvwxyza"};
    for (int i = 0; i < s.length(); i++){
        if (s[i] >= 'a' && s[i] <= 'z'){
            str += arr[s[i] - 'a'];
        }

        else if (s[i] >= 'A' && s[i] <= 'Z'){
            str += brr[s[i] - 'A'];
        }

        else {
            str += s[i];
        }
    }
    return str;
}

int main() {
    string str;
    while (cin >> str){
        cout << Secure(str) << endl;
    }
}

全部评论

相关推荐

不愿透露姓名的神秘牛友
06-27 15:19
简历上能写3个月吗?
码农索隆:大胆写,主要你能把实习经历包装好,可以看一下我这篇帖子https://www.nowcoder.com/share/jump/4888395581180798063
点赞 评论 收藏
分享
喜欢飞来飞去的雪碧在...:可以试一试字节
点赞 评论 收藏
分享
_mos_:我以为手抄报简历就已经很顶了,没想到还有表格简历
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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