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