提交时间:2025-12-05 15:49:01
运行 ID: 75348
#include <iostream> #include <string> #include <algorithm> using namespace std; string decrypt(const string& encrypted) { string decrypted = encrypted; int n = decrypted.size(); // 逆序存储 reverse(decrypted.begin(), decrypted.end()); // 循环右移3位并大小写反转 for (int i = 0; i < n; ++i) { char c = decrypted[i]; if (islower(c)) { decrypted[i] = toupper((c - 'a' + 3) % 26 + 'A'); } else { decrypted[i] = tolower((c - 'A' + 3) % 26 + 'a'); } } return decrypted; } int main() { string encrypted; cin >> encrypted; cout << decrypt(encrypted) << endl; return 0; }