import static java.lang.System.out;
import java.util.Scanner;
import java.util.regex.Pattern;
import java.util.regex.Matcher;

class Main{
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String[] strs = scan.nextLine().split("");
        Pattern upper = Pattern.compile("[a-z]");
        Pattern lower = Pattern.compile("[A-Z]");
        for(String str : strs) {
            Matcher mUpper = upper.matcher(str);
            Matcher mLower = lower.matcher(str);
            if (mUpper.find()) {
                out.print(str.toUpperCase());
            } else if(mLower.find()) {
                out.print(str.toLowerCase());
            } else {
                out.print(str);                                        
            }
        }
        out.println();
    }
} import static java.lang.System.out; import static java.lang.System.out; import static java.lang.System.out; import java.util.Scanner; Scanner java.util import java.util.regex.Pattern; Pattern java.util.regex import java.util.regex.Matcher; Matcher java.util.regex class Main{
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String[] strs = scan.nextLine().split("");
        Pattern upper = Pattern.compile("[a-z]");
        Pattern lower = Pattern.compile("[A-Z]");
        for(String str : strs) {
            Matcher mUpper = upper.matcher(str);
            Matcher mLower = lower.matcher(str);
            if (mUpper.find()) {
                out.print(str.toUpperCase());
            } else if(mLower.find()) {
                out.print(str.toLowerCase());
            } else {
                out.print(str);                                        
            }
        }
        out.println();
    }
} Main public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String[] strs = scan.nextLine().split("");
        Pattern upper = Pattern.compile("[a-z]");
        Pattern lower = Pattern.compile("[A-Z]");
        for(String str : strs) {
            Matcher mUpper = upper.matcher(str);
            Matcher mLower = lower.matcher(str);
            if (mUpper.find()) {
                out.print(str.toUpperCase());
            } else if(mLower.find()) {
                out.print(str.toLowerCase());
            } else {
                out.print(str);                                        
            }
        }
        out.println();
    } main {
        Scanner scan = new Scanner(System.in);
        String[] strs = scan.nextLine().split("");
        Pattern upper = Pattern.compile("[a-z]");
        Pattern lower = Pattern.compile("[A-Z]");
        for(String str : strs) {
            Matcher mUpper = upper.matcher(str);
            Matcher mLower = lower.matcher(str);
            if (mUpper.find()) {
                out.print(str.toUpperCase());
            } else if(mLower.find()) {
                out.print(str.toLowerCase());
            } else {
                out.print(str);                                        
            }
        }
        out.println();
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String[] strs = scan.nextLine().split(""); strs scan.nextLine().split("") scan.nextLine().split scan.nextLine() scan.nextLine scan "" Pattern upper = Pattern.compile("[a-z]"); upper Pattern.compile("[a-z]") Pattern.compile Pattern "[a-z]" Pattern lower = Pattern.compile("[A-Z]"); lower Pattern.compile("[A-Z]") Pattern.compile Pattern "[A-Z]" for(String str : strs) {
            Matcher mUpper = upper.matcher(str);
            Matcher mLower = lower.matcher(str);
            if (mUpper.find()) {
                out.print(str.toUpperCase());
            } else if(mLower.find()) {
                out.print(str.toLowerCase());
            } else {
                out.print(str);                                        
            }
        } String str strs {
            Matcher mUpper = upper.matcher(str);
            Matcher mLower = lower.matcher(str);
            if (mUpper.find()) {
                out.print(str.toUpperCase());
            } else if(mLower.find()) {
                out.print(str.toLowerCase());
            } else {
                out.print(str);                                        
            }
        } {
            Matcher mUpper = upper.matcher(str);
            Matcher mLower = lower.matcher(str);
            if (mUpper.find()) {
                out.print(str.toUpperCase());
            } else if(mLower.find()) {
                out.print(str.toLowerCase());
            } else {
                out.print(str);                                        
            }
        } Matcher mUpper = upper.matcher(str); mUpper upper.matcher(str) upper.matcher upper str Matcher mLower = lower.matcher(str); mLower lower.matcher(str) lower.matcher lower str if (mUpper.find()) {
                out.print(str.toUpperCase());
            } else if(mLower.find()) {
                out.print(str.toLowerCase());
            } else {
                out.print(str);                                        
            } mUpper.find() mUpper.find mUpper {
                out.print(str.toUpperCase());
            } out.print(str.toUpperCase()) out.print out str.toUpperCase() str.toUpperCase str if(mLower.find()) {
                out.print(str.toLowerCase());
            } else {
                out.print(str);                                        
            } mLower.find() mLower.find mLower {
                out.print(str.toLowerCase());
            } out.print(str.toLowerCase()) out.print out str.toLowerCase() str.toLowerCase str {
                out.print(str);                                        
            } out.print(str) out.print out str out.println() out.println out String[] args args
import static java.lang.System.out;
import java.util.Scanner;
import java.util.regex.Pattern;
import java.util.regex.Matcher;

class Main{
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String[] strs = scan.nextLine().split("");
        Pattern upper = Pattern.compile("[a-z]");
        Pattern lower = Pattern.compile("[A-Z]");
        for(String str : strs) {
            Matcher mUpper = upper.matcher(str);
            Matcher mLower = lower.matcher(str);
            if (mUpper.find()) {
                out.print(str.toUpperCase());
            } else if(mLower.find()) {
                out.print(str.toLowerCase());
            } else {
                out.print(str);                                        
            }
        }
        out.println();
    }
}