fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. string inverseString(const string &input) {
  5. string result = input; // Create a copy of the input string
  6.  
  7. for (int i = 0; i < result.length(); ++i) {
  8. if (isalpha(result[i])) {
  9. if (isupper(result[i])) {
  10. // For uppercase letters
  11. result[i] = 'Z' - (result[i] - 'A');
  12. } else {
  13. // For lowercase letters
  14. result[i] = 'z' - (result[i] - 'a');
  15. }
  16. }
  17. }
  18.  
  19. return result;
  20. }
  21.  
  22. int main() {
  23. string input;
  24. getline(cin, input); // Read input string
  25.  
  26. string output = inverseString(input); // Get the inverse of the string
  27.  
  28. cout << output << endl; // Output the result
  29.  
  30. return 0;
  31. }
  32.  
Success #stdin #stdout 0.01s 5284KB
stdin
"MY NAMe is Sourajit Sahoo!!"
stdout
"NB MZNv rh Hlfizqrg Hzsll!!"