fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. // your code goes here
  6.  
  7. string str;
  8.  
  9. getline(cin,str);
  10.  
  11. for(int i=0; i< str.size(); i++) {
  12. char ch = str[i];
  13. if(ch>='a' && ch <='z'){
  14. ch = ch - 'a' + 'A'; // lowercase to uppercase
  15. }
  16. else {
  17. ch = ch - 'A' + 'a'; // uppercase to lowercase
  18. }
  19. str[i] = ch;
  20. }
  21.  
  22. cout<<str;
  23.  
  24. return 0;
  25. }
Success #stdin #stdout 0s 4296KB
stdin
aBcD
stdout
AbCd