SHARE
TWEET

Untitled

a guest Nov 9th, 2019 101 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int isCapsOn(string s){
  6.     for(int i = 1; i<s.size(); i++){
  7.         if(islower(s[i])){
  8.             return 0;
  9.         }
  10.     }
  11.  
  12.     return 1;
  13. }
  14.  
  15.  
  16. int main(){
  17.  
  18.     string sinp;
  19.     cin >> sinp;
  20.  
  21.     if(isCapsOn(sinp)){
  22.        
  23.         for(int i = 0; i<sinp.size(); i++){
  24.  
  25.             if( islower(sinp[i]) )
  26.                 sinp[i] = toupper(sinp[i]);
  27.  
  28.             else
  29.                 sinp[i] = tolower(sinp[i]);
  30.         }
  31.        
  32.         cout << sinp << endl;
  33.     }
  34.     else
  35.         cout << sinp << endl;
  36.  
  37.     return 0;
  38. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top