题解 | #简单密码#

简单密码

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

#include <cctype>
#include <cstdio>
#include <iostream>
using namespace std;

void convert(string &str){
    for(int i=0;i<str.size();i++){
        if(isalpha(str[i])){
            str[i]='A'+(str[i]-'A'-5+26)%26;
        }
    }
}

int main() {
    string s,e;
    while(getline(cin,s)&&s!="ENDOFINPUT"){
        if(s=="START"){
            string str;
            getline(cin,str);
            convert(str);
            cout<<str<<endl;
            getline(cin,e);
        }
    }
    return 0;
}

全部评论

相关推荐

头像 会员标识
02-14 15:34
门头沟学院 Java
Java抽象带篮子:专业技能怎么写可以看看我发的帖子
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务