题解 | #简单密码#
简单密码
https://www.nowcoder.com/practice/ff99c43dd07f4e95a8f2f5448da3772a
#include <bits/stdc++.h> using namespace std; int main() { string str; while(getline(cin,str)) { if (str=="ENDOFINPUT") { break; } else if (str!="START"&&str!="END") { for (int i = 0; i < str.size(); ++i) { if (str[i]>='a'&&str[i]<='z'||str[i]>='A'&&str[i]<='Z') { str[i]=(str[i]-'A'-5+26)%26+'A'; } } cout<<str<<endl; } } }