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