codeforces 708ALetter Cyclic Shift
程序员文章站
2022-03-22 11:53:36
2019-05-18 09:51:19 加油,加油,fightting !!! https://www.cnblogs.com/ECJTUACM-873284962/p/6375011.html 全为aaaaaa的情况一定要注意 ......
2019-05-18
09:51:19
加油,加油,fightting !!!
https://www.cnblogs.com/ecjtuacm-873284962/p/6375011.html
全为aaaaaa的情况一定要注意
#include <bits/stdc++.h> using namespace std; int main() { string s; int j, i; int flat = 0; cin >> s; for (i = 0; i < s.length(); i++) { if (s[i] != 'a') { s[i] = s[i] - 1; flat = 1; } else if (s[i] == 'a' && flat == 1) { break; } } if(flat == 0) { s[s.length() - 1] = 'z'; } for (i = 0; i < s.length(); i++) { cout << s[i]; } return 0; }