wHAT DO WE NEED cAPS LOCK FOR?

Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage. 

Let's consider that a word has been typed with the Caps lock key accidentally switched on, if: 

  * either it only contains uppercase letters; 
  * or all letters except for the first one are uppercase. 



In this case we should automatically change the case of all letters. For example, the case of the letters that form words "hELLO", "HTTP", "z" should be changed.

Write a program that applies the rule mentioned above. If the rule cannot be applied, the program should leave the word unchanged.

Input

The first line of the input data contains a word consisting of uppercase and lowercase Latin letters. The word's length is from 1 to 100 characters, inclusive.

Output

Print the result of the given word's processing.

Examples

Input

cAPS


Output

Caps

Input

Lock


Output

Lock
import java.util.Scanner;

public class MI_PRIMER_PROBLEMA {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		
		/*Scanner sc= new Scanner(System.in);
		String palabra = sc.nextLine();
		String minuscula = palabra.toLowerCase();
		char letra = palabra.charAt(0);
		String letra2= (letra+"").toUpperCase();
		String minuscula_incompleta = minuscula.substring(1);
		System.out.println(letra2+minuscula_incompleta);*/
		
		 /*Scanner sc = new Scanner(System.in);
	        String  jugadores = sc.next();
	        if(jugadores.contains("1111111")||jugadores.contains("0000000"))
	            System.out.println("YES");
	        else
	            System.out.println("NO");*/
		
	        /*Scanner sc = new Scanner(System.in);
	    	String palabra = sc.nextLine(), palabra2 = sc.nextLine();
	    	String palabraUpdated = palabra.toLowerCase(), palabra2Updated = palabra2.toLowerCase();
	    	int value = 0;{
	    	for (int i = 0; i < palabraUpdated.length(); i++)
	    		if (palabraUpdated.charAt(i) == palabra2Updated.charAt(i))
	    			continue;
	    		else if (palabraUpdated.charAt(i) < palabra2Updated.charAt(i)) {
	    			value = -1;
	    			break;
	    		} else {
	    			value = 1;
	    			break;
	    		}
	    	System.out.println(value);
	    	sc.close();*/
    
		/*Scanner sc = new Scanner(System.in);
		System.out.println();
		String palabra = sc.nextLine();
		char letra = palabra.charAt(0);
		String letra2= (letra+"").toUpperCase();	
		String palabra2 = palabra.substring(1);
		System.out.println(letra2+palabra2);*/
		
		
		
		/*Scanner sc= new Scanner(System.in);
		System.out.println();
		String palabra = sc.nextLine();
		String minuscula = palabra.toLowerCase();
		for(int i=0; i < minuscula.length();i++){*/
		
		
		/*Scanner sc = new Scanner(System.in);
		String palabra = sc.nextLine();
		StringBuilder stringBuilder = new StringBuilder();
		for (int i = 0; i < palabra.length(); i++) {
			char consonante = palabra.charAt(i);
			if (isVowel(consonante))
				continue;
			else if (Character.isUpperCase(palabra.charAt(i)))
				stringBuilder.append(".").append(Character.toLowerCase(palabra.charAt(i)));
			else
				stringBuilder.append(".").append(palabra.charAt(i));
		}
		System.out.println(stringBuilder.toString());

		sc.close();

	}

	public static boolean isVowel(char consonante) {
		String vocales = "AOYEUIaoyeui";
		for (int i = 0; i < vocales.length(); i++)
			if (vocales.charAt(i) == consonante)
				return true;
		return false;

		
		}*/
			
	/*Scanner sc = new Scanner(System.in);
	System.out.println();
	int n = sc.nextInt();
	for(int i = 1; i <= n; i++){
		int numero = i % 2;
		if(numero == 1){
			System.out.print("I hate ");
	}else 
				System.out.print("I love ");
		if (i==n){
		System.out.print("it ");
	}else 
			System.out.print("that ");
				
	}*/
	
	/*Scanner sc= new Scanner(System.in);
	System.out.println();
	int n = sc.nextInt();
	String s = new String("");
	
	for(int i = 0; i < n-1; i++){
		if(i % 2 == 0) s = s + "I hate that ";
		if(i % 2 != 0) s = s + "I love that ";
	}
	if(n % 2 == 0) s = s + "I love it ";
	if(n % 2 != 0) s = s + "I hate it ";
	System.out.println(s);*/
	
		/*Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		sc.close();
		StringBuilder palabra = new StringBuilder();
		if (n == 1) {
			System.out.println("I hate it");
			return;
		}
		for (int i = 1; i <= n; i++) {
			if (i == n) {
				if (i % 2 == 1)
					palabra.append("I hate it");
				else
					palabra.append("I love it");
			} else {
				if (i % 2 == 1)
					palabra.append("I hate that ");
				else
					palabra.append("I love that ");
			}
		}
		System.out.println(palabra.toString());	*/
		
		/*Scanner sc = new Scanner(System.in);
		String numero = sc.next();{
		if(numero.contains("1111111") || numero.contains("0000000")){
			System.out.println("YES");
		} else {
			System.out.println("NO");
			
		}
			
		}*/
		
		/*Scanner sc= new Scanner(System.in);
		String palabra = sc.next();	 
	   	palabra = palabra.replace("WUB"," ").trim();
	   	System.out.println(palabra);*/
		
		/*Scanner sc = new Scanner(System.in);
		String palabra = sc.nextLine();
		String minuscula = palabra.toLowerCase();
		char letra = minuscula.charAt(0);
		String letra2= (letra+"").toUpperCase();
		String minuscula2 = minuscula.substring(1);
		System.out.println(letra2+minuscula2);*/
		
		
		/*Scanner sc = new Scanner(System.in);
		int n;
		int d = 0; 
		n = sc.nextInt();
		for (int ai = 1; ai<=n;ai++){
			int b = sc.nextInt();
			if(b == 0){
				d = d +1;
			}	
		}

		if (n == 1){
			if (d == 0){
				System.out.println("YES");

			}
			else {
				System.out.println("NO");
			}

		}
		else{
			if (d == 1){
			System.out.println("YES");
			}
			else {
			System.out.println("NO");
			}
		}*/

		Scanner sc = new Scanner(System.in);
		String str = sc.nextLine();
		char palabra = str.charAt(0);
		str = str.substring(1);

		if(str.toUpperCase() == str) {
			str = str.toLowerCase();
			if(Character.toUpperCase(palabra) == palabra) 
				palabra = Character.toLowerCase(palabra);
			else
				palabra = Character.toUpperCase(palabra);
		}
		System.out.println(palabra + str);
}
}







