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 C# (judge verdict: Accepted)

using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using System.Threading;
using System.IO;
using System.Text;

//============================================================================
namespace Sweet
{
    class Program
    {
        static StreamWriter writer = null;

        //============================================================================
        static void setstdio(string[] args)
        {
            if (0 < args.Length)
            {
                // Redirect standard input from the console to the input file.
                Console.SetIn(new StreamReader(args[0]));
                if (args.Length == 2)
                {
                    // Attempt to open output file.
                    writer = new StreamWriter(args[1]);
                    // Redirect standard output from the console to the output file.
                    Console.SetOut(writer);
                }
            }

        }
        //============================================================================
        static void fillmatrix(uint m, uint n, Int64[,] ary)
        {
            int i, j,a;

            for (i = 0; i < m; i++)
            {
                string str = Console.ReadLine();
                for (j = 0; j < n; j++)
                {
                    a = str.IndexOf(" ");
                    if (0 <= a)
                    {
                        ary[i, j] = uint.Parse(str.Substring(0, a));
                        str = str.Substring(a + 1);
                    }
                    else
                        ary[i, j] = uint.Parse(str.Substring(0));
                }
            }
        }
        //============================================================================
        //============================================================================
        private static void Swing()
        {
            StringBuilder builder = new StringBuilder(Console.ReadLine());
            for (int i = 0; i < builder.Length; i++)
                if ('A' <= builder[i] && builder[i] <= 'Z' || 'a' <= builder[i] && builder[i] <= 'z')
                    builder[i] = (char)(builder[i] ^ ' ');
            Console.WriteLine(builder);
        }
        //============================================================================
        static void Main(string[] args)
        {
            setstdio(args);

            Swing();
            if (writer != null)
                writer.Close();
            //Console.ReadLine();
        }
        //============================================================================
    }
}