#include <iostream> using namespace std; int main(){ string s; int n=0; cin >> s ; if(s.size() == 1){ if(s[0]<= 'z' && 'a' <= s[0]){ s[0]-=32; cout <<s[0]; return 0 ; } else if(s[0]<= 'z' && 'a' <= s[0]){ s[0]+=32; cout << s[0]; return 0; } } for(int i = 0 ;i < s.size(); i++ ){ if(s[i] <= 'z' && 'a'<= s[i]){ n++; } } if(n>=2){ cout << s; return 0; } else{ if(s[0]<= 'Z' && 'A'<= s[0] && n!=0){ cout << s; return 0; } for(int i = 0 ;i < s.size(); i++ ){ if(s[i] <= 'z' && 'a'<= s[i]){ s[i]-=32; } else { s[i]+=32; } } cout << s; } }