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.util.Scanner;

/**
 * Toggling Cases
 */
public class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);

        char[] charArray = scan.nextLine().toCharArray();
        scan.close();
        StringBuffer sb = new StringBuffer();
        for (char chara: charArray) {
            if (Character.isUpperCase(chara)) {
                sb.append(String.valueOf(chara).toLowerCase());
            } else {
                sb.append(String.valueOf(chara).toUpperCase());
            }
        }
        System.out.println(sb);
    }
}