#include <iostream>
#include <stdio.h>
#include <ctype.h>
#include <string>
using namespace std;
 
int main (){
 
//変数宣言
 
    int i=0,j=0;
    string temp,str="";
 
    while(cin>>temp){
//変換
        for(i=0;i<temp.size();i++){
            if (islower(temp[i])){
                temp[i] = toupper(temp[i]);
            }else{
                temp[i] = tolower(temp[i]);
            }
        }
         
        if (j!=0) {
            str = str + " " + temp;
        }else{
            str = temp;
        }
        j++;
         
    }
     
//出力
    cout << str << endl;
    return 0;
}