#include <bits/stdc++.h> using namespace std; bool isEngChar(char c){ if(c<='Z' && c>='A')return true; else if(c<='z' && c>='a')return true; return false; } char change(char c){ if(isEngChar(c+1))return c+1; else if(c == 'Z')return 'A'; return 'a'; } int main() { string s;getline(cin,s); string res; for(int i =0;i<s.length();i++){ if(isEngChar(s[i])) res.push_back(change(s[i])); else res.push_back(s[i]); } cout<<res; } // 64 位输出请用 printf("%lld")
简单遍历字符串