题解 | 简单密码

简单密码

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

#include <iostream>
#include <string>
using namespace std;
void decrypt(char &a){
    if(a>='A'&&a<='Z') a=(a-'A'+26-5)%26+'A';
}
int main() {
    string a;
    while(getline(cin,a)){
        if(a=="START"){
            string b,c;
            getline(cin,b);
            for(char &i:b){
                decrypt(i);
            }
            cout<<b<<endl;
            getline(cin,c);
            if(c=="END") continue;
        }
        else if(a=="ENDOFINPUT") break;
    }
    return 0;
}

全部评论

相关推荐

xtu大迫杰:偶遇校友,祝校友offer打牌
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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