Write a program Toggle String .

11. Write a program Toggle String .


 You have been given a String S consisting of uppercase and lowercase English alphabets. You need to change the case of each alphabet in this String. That is, all the uppercase letters should be converted to lowercase and all the lowercase letters should be converted to uppercase. You need to then print the resultant String to output.




using System;

public class Program
{
public static void Main()
{
  string Mystring = Console.ReadLine();
char CharIndex;
char[] charValue;
int CharLength = Mystring.Length;
charValue = Mystring.ToCharArray(0, CharLength);
for(int i =0; i< CharLength;i++)
{
CharIndex = charValue[i];
if(char.IsUpper(CharIndex))
{
var data= CharIndex.ToString();
Console.Write(data.ToLower());
}else if(char.IsLower(CharIndex))
{
var value= CharIndex.ToString();
Console.Write(value.ToUpper());
}
}
    } 
}


Input : abcdE

Output : ABCDe