博约8486 • 1天前
using namespace std;
char change(char c){
char newc ;
if(c >= 'a' && c <= 'z'){
newc = c + 'A' - 'a';
}else if(c >= 'A' && c <= 'Z'){
newc = c - 'A' + 'a';
}
return newc;
}
int main(){
string s;
cin >> s;
for(int i = 0; i < s.length(); i++){
s[i] = change(s[i]);
}
reverse(s.begin(), s.end());
for(int i = 0; i < s.length(); i++){
if(s[i] == 'x') s[i] = 'a';
else if(s[i] == 'y') s[i] = 'b';
else if(s[i] == 'z') s[i] = 'c';
else if(s[i] == 'X') s[i] = 'A';
else if(s[i] == 'Y') s[i] = 'B';
else if(s[i] == 'Z') s[i] = 'C';
else s[i] = s[i] + 3;
}
cout << s;
}
评论:
请先登录,才能进行评论