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.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{
    public static void main(String args[]) throws Exception{
        FastReader fr = new FastReader();
        String input = fr.readLine();
        StringBuilder output = new StringBuilder();
        for(String s : input.split(" ")){
        	output.append(solve(s) + " ");
        }
        System.out.println(output.toString().trim());
    }

    private static String solve(String input){
    	boolean allUpper = true, allUpperExceptFirst = true;
    	StringBuilder invert = new StringBuilder();
    	char c;
    	for(int i = 0; i < input.length(); i++){
    		c = input.charAt(i);
    		if(Character.isLowerCase(c)){
    			invert.append(Character.toUpperCase(c));
    			allUpper = false;
    			if(i != 0){
    				allUpperExceptFirst = false;
    			}
    		}
    		else{
    			invert.append(Character.toLowerCase(c));
    		}
    	}
    	if(allUpper || allUpperExceptFirst){
    		return invert.toString();
    	}
    	else{
    		return input;
    	}
    }
}

class FastReader{
    final private int BUFFER_SIZE = 1 << 16;
    private DataInputStream din;
    private byte[] buffer;
    private int bufferPointer, bytesRead;
    private boolean usedNext;

    public FastReader(){
        din = new DataInputStream(System.in);
        buffer = new byte[BUFFER_SIZE];
        bufferPointer = bytesRead = 0;
        usedNext = false;
    }

    public FastReader(String file_name) throws IOException{
        din = new DataInputStream(new FileInputStream(file_name));
        buffer = new byte[BUFFER_SIZE];
        bufferPointer = bytesRead = 0;
        usedNext = false;
    }

    public String readLine() throws IOException{
    	if(usedNext){
    		usedNext = false;
    		readLine();
    	}
        byte[] buf = new byte[110];
        int cnt = 0, c;
        while((c = read()) != -1){
            if (c == '\n')
                break;
            buf[cnt++] = (byte) c;
        }
        return new String(buf, 0, cnt).trim();
    }

    public int nextInt() throws IOException{
    	usedNext = true;
        int ret = 0;
        byte c = read();
        while (c <= ' ')
            c = read();
        boolean neg = (c == '-');
        if(neg)
            c = read();
        do{
        	ret = ret * 10 + c - '0';
        }while((c = read()) >= '0' && c <= '9');
        if(neg)
        	return -ret;
        return ret;
    }

    public long nextLong() throws IOException{
    	usedNext = true;
        long ret = 0;
        byte c = read();
        while(c <= ' ')
            c = read();
        boolean neg = (c == '-');
        if(neg)
            c = read();
        do{
            ret = ret * 10 + c - '0';
        }
        while((c = read()) >= '0' && c <= '9');
        if(neg)
            return -ret;
        return ret;
    }

    public double nextDouble() throws IOException{
    	usedNext = true;
        double ret = 0, div = 1;
        byte c = read();
        while(c <= ' ')
            c = read();
        boolean neg = (c == '-');
        if(neg)
            c = read();
        do{
            ret = ret * 10 + c - '0';
        }
        while((c = read()) >= '0' && c <= '9');
        if(c == '.'){
            while ((c = read()) >= '0' && c <= '9'){
                ret += (c - '0') / (div *= 10);
            }
        }
        if(neg)
            return -ret;
        return ret;
    }

    private void fillBuffer() throws IOException{
        bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
        if(bytesRead == -1)
            buffer[0] = -1;
    }

    private byte read() throws IOException{
        if(bufferPointer == bytesRead)
            fillBuffer();
        return buffer[bufferPointer++];
    }

    public void close() throws IOException{
        if(din == null)
            return;
        din.close();
    }
}