import java.io.IOException;
import java.util.Scanner;
public class Main {

	public static void main(String[] args) throws Exception {
		// TODO ?????????????????????????????????????????????
			Scanner sc = new Scanner(System.in);
			String a = sc.nextLine();
			boolean b;
			int c = a.length();
			char e;
			for(int d = 0 ; d < c ; d++){
				e = a.charAt(d);
				b = Character.isUpperCase(e);
				if(d!=c-1){
					if(b==true){
						System.out.print(Character.toLowerCase(e));
					}else{
						System.out.print(Character.toUpperCase(e));
					}
				}else{
					if(b==true){
						System.out.println(Character.toLowerCase(e));
					}else{
						System.out.println(Character.toUpperCase(e));
					}
				}
			}
	}

} import java.io.IOException; IOException java.io import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) throws Exception {
		// TODO ?????????????????????????????????????????????
			Scanner sc = new Scanner(System.in);
			String a = sc.nextLine();
			boolean b;
			int c = a.length();
			char e;
			for(int d = 0 ; d < c ; d++){
				e = a.charAt(d);
				b = Character.isUpperCase(e);
				if(d!=c-1){
					if(b==true){
						System.out.print(Character.toLowerCase(e));
					}else{
						System.out.print(Character.toUpperCase(e));
					}
				}else{
					if(b==true){
						System.out.println(Character.toLowerCase(e));
					}else{
						System.out.println(Character.toUpperCase(e));
					}
				}
			}
	}

} Main public static void main(String[] args) throws Exception {
		// TODO ?????????????????????????????????????????????
			Scanner sc = new Scanner(System.in);
			String a = sc.nextLine();
			boolean b;
			int c = a.length();
			char e;
			for(int d = 0 ; d < c ; d++){
				e = a.charAt(d);
				b = Character.isUpperCase(e);
				if(d!=c-1){
					if(b==true){
						System.out.print(Character.toLowerCase(e));
					}else{
						System.out.print(Character.toUpperCase(e));
					}
				}else{
					if(b==true){
						System.out.println(Character.toLowerCase(e));
					}else{
						System.out.println(Character.toUpperCase(e));
					}
				}
			}
	} main {
		// TODO ?????????????????????????????????????????????
			Scanner sc = new Scanner(System.in);
			String a = sc.nextLine();
			boolean b;
			int c = a.length();
			char e;
			for(int d = 0 ; d < c ; d++){
				e = a.charAt(d);
				b = Character.isUpperCase(e);
				if(d!=c-1){
					if(b==true){
						System.out.print(Character.toLowerCase(e));
					}else{
						System.out.print(Character.toUpperCase(e));
					}
				}else{
					if(b==true){
						System.out.println(Character.toLowerCase(e));
					}else{
						System.out.println(Character.toUpperCase(e));
					}
				}
			}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String a = sc.nextLine(); a sc.nextLine() sc.nextLine sc boolean b; b int c = a.length(); c a.length() a.length a char e; e for(int d = 0 ; d < c ; d++){
				e = a.charAt(d);
				b = Character.isUpperCase(e);
				if(d!=c-1){
					if(b==true){
						System.out.print(Character.toLowerCase(e));
					}else{
						System.out.print(Character.toUpperCase(e));
					}
				}else{
					if(b==true){
						System.out.println(Character.toLowerCase(e));
					}else{
						System.out.println(Character.toUpperCase(e));
					}
				}
			} int d = 0 ; int d = 0 ; d 0 d < c d c d++ d++ d {
				e = a.charAt(d);
				b = Character.isUpperCase(e);
				if(d!=c-1){
					if(b==true){
						System.out.print(Character.toLowerCase(e));
					}else{
						System.out.print(Character.toUpperCase(e));
					}
				}else{
					if(b==true){
						System.out.println(Character.toLowerCase(e));
					}else{
						System.out.println(Character.toUpperCase(e));
					}
				}
			} {
				e = a.charAt(d);
				b = Character.isUpperCase(e);
				if(d!=c-1){
					if(b==true){
						System.out.print(Character.toLowerCase(e));
					}else{
						System.out.print(Character.toUpperCase(e));
					}
				}else{
					if(b==true){
						System.out.println(Character.toLowerCase(e));
					}else{
						System.out.println(Character.toUpperCase(e));
					}
				}
			} e = a.charAt(d) e a.charAt(d) a.charAt a d b = Character.isUpperCase(e) b Character.isUpperCase(e) Character.isUpperCase Character e if(d!=c-1){
					if(b==true){
						System.out.print(Character.toLowerCase(e));
					}else{
						System.out.print(Character.toUpperCase(e));
					}
				}else{
					if(b==true){
						System.out.println(Character.toLowerCase(e));
					}else{
						System.out.println(Character.toUpperCase(e));
					}
				} d!=c-1 d c-1 c 1 {
					if(b==true){
						System.out.print(Character.toLowerCase(e));
					}else{
						System.out.print(Character.toUpperCase(e));
					}
				} if(b==true){
						System.out.print(Character.toLowerCase(e));
					}else{
						System.out.print(Character.toUpperCase(e));
					} b==true b true {
						System.out.print(Character.toLowerCase(e));
					} System.out.print(Character.toLowerCase(e)) System.out.print System.out System System.out Character.toLowerCase(e) Character.toLowerCase Character e {
						System.out.print(Character.toUpperCase(e));
					} System.out.print(Character.toUpperCase(e)) System.out.print System.out System System.out Character.toUpperCase(e) Character.toUpperCase Character e {
					if(b==true){
						System.out.println(Character.toLowerCase(e));
					}else{
						System.out.println(Character.toUpperCase(e));
					}
				} if(b==true){
						System.out.println(Character.toLowerCase(e));
					}else{
						System.out.println(Character.toUpperCase(e));
					} b==true b true {
						System.out.println(Character.toLowerCase(e));
					} System.out.println(Character.toLowerCase(e)) System.out.println System.out System System.out Character.toLowerCase(e) Character.toLowerCase Character e {
						System.out.println(Character.toUpperCase(e));
					} System.out.println(Character.toUpperCase(e)) System.out.println System.out System System.out Character.toUpperCase(e) Character.toUpperCase Character e String[] args args public class Main {

	public static void main(String[] args) throws Exception {
		// TODO ?????????????????????????????????????????????
			Scanner sc = new Scanner(System.in);
			String a = sc.nextLine();
			boolean b;
			int c = a.length();
			char e;
			for(int d = 0 ; d < c ; d++){
				e = a.charAt(d);
				b = Character.isUpperCase(e);
				if(d!=c-1){
					if(b==true){
						System.out.print(Character.toLowerCase(e));
					}else{
						System.out.print(Character.toUpperCase(e));
					}
				}else{
					if(b==true){
						System.out.println(Character.toLowerCase(e));
					}else{
						System.out.println(Character.toUpperCase(e));
					}
				}
			}
	}

} public class Main {

	public static void main(String[] args) throws Exception {
		// TODO ?????????????????????????????????????????????
			Scanner sc = new Scanner(System.in);
			String a = sc.nextLine();
			boolean b;
			int c = a.length();
			char e;
			for(int d = 0 ; d < c ; d++){
				e = a.charAt(d);
				b = Character.isUpperCase(e);
				if(d!=c-1){
					if(b==true){
						System.out.print(Character.toLowerCase(e));
					}else{
						System.out.print(Character.toUpperCase(e));
					}
				}else{
					if(b==true){
						System.out.println(Character.toLowerCase(e));
					}else{
						System.out.println(Character.toUpperCase(e));
					}
				}
			}
	}

} Main
import java.io.IOException;
import java.util.Scanner;
public class Main {

	public static void main(String[] args) throws Exception {
		// TODO ?????????????????????????????????????????????
			Scanner sc = new Scanner(System.in);
			String a = sc.nextLine();
			boolean b;
			int c = a.length();
			char e;
			for(int d = 0 ; d < c ; d++){
				e = a.charAt(d);
				b = Character.isUpperCase(e);
				if(d!=c-1){
					if(b==true){
						System.out.print(Character.toLowerCase(e));
					}else{
						System.out.print(Character.toUpperCase(e));
					}
				}else{
					if(b==true){
						System.out.println(Character.toLowerCase(e));
					}else{
						System.out.println(Character.toUpperCase(e));
					}
				}
			}
	}

}