1008 -- 大小写互换

大小写互换

Time Limit:1000MS  Memory Limit:65536K
Total Submit:482 Accepted:282

Description

现在给出了一个只包含大小写字母的字符串,不含空格和换行,要求把其中的大写换成小写,小写换成大写,然后输出互换后的字符串。

Input

第一行只有一个整数m(m<=10),表示测试数据组数。
接下来的m行,每行有一个字符串(长度不超过100)。

Output

输出互换后的字符串,每组输出占一行。

Sample Input

2
Acm
ACCEPTED

Sample Output

aCM
accepted

Source

acm.nyist.net

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    namespace AK1008 {
        class Program {
            static void Main(string[] args) {
                int n = int.Parse(Console.ReadLine());
                while (n-- > 0) {
                    string s = Console.ReadLine();
                    for (int i = 0; i < s.Length; i++) {
                        if (s[i] >= 'a' && s[i] <= 'z')
                            Console.Write(s[i].ToString().ToUpper());
                        else
                            Console.Write(s[i].ToString().ToLower());
                    }
                    Console.WriteLine();
                }
            }
        }
    }



版权声明:本文为jtahstu_akoj原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。