Problem:
Toggling Cases

Write a program which converts uppercase/lowercase letters to lowercase/uppercase for a given string.

Input

A string is given in a line.

Output

Print the converted string in a line. Note that you do not need to convert any characters other than alphabetical letters.

Constraints

The length of the input string < 1200

Sample Input

fAIR, LATER, OCCASIONALLY CLOUDY.

Sample Output

Fair, later, occasionally cloudy.

Solution in JAVA (judge verdict: Accepted)

import java.io.*;

public class Main{
    public static void main(String[] args){
        try{
            BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
            int i = 0;
            String line;
            line = reader.readLine();
            String[] charactor = line.split("",line.length());
            String[] output;
            String tmp;
            output = new String[line.length()];
            for(i = 0; i < line.length(); i++){
                tmp = charactor[i];
                tmp = tmp.toLowerCase();
                if(charactor[i].equals(tmp) == true){
                    output[i] = charactor[i].toUpperCase();
                }else if(charactor[i].equals(tmp) == false){
                    output[i] = charactor[i].toLowerCase();
                }else{
                    output[i] = charactor[i];
                }
            }
            for(i = 0; i < line.length(); i++){
                System.out.print(output[i]);
            }
            System.out.print("\n");

        } catch (NumberFormatException e) {
            System.out.println(e);
        } catch (IOException e) {
            System.out.println(e);
        }
    }
}