Problem title
Difficulty
Avg time to solve

Ninja And Editor
Easy
20 mins
Encoded Letter
Moderate
25 mins
Tree Jumping
Hard
50 mins
Base Conversion
Easy
15 mins
Number of ones in the smallest repunit
Moderate
30 mins
Conversion
Easy
20 mins
Remove Comments
Moderate
15 mins
Last Substring In Lexicographical Order
Hard
45 mins
Minimum And Maximum
Easy
15 mins
Rectangles In N x N Board
Moderate
20 mins

Change Case

Difficulty: EASY
Contributed By

Problem Statement

You are given a non-empty string ‘STR’, consisting of both lowercase and uppercase English alphabetical letters. Your task is to convert the characters of the string into the opposite case, i.e. if a character is in lower case then convert it into the upper case and vice-versa.

For Example:
If STR = ‘aBc’,
After converting ‘a’ to ‘A’, ‘B’ to ‘b’, and ‘c’ to ‘C’ we got our final string as ‘AbC’.
Input Format :
The first line of the input contains an integer, 'T’, denoting the number of test cases.

The first and only line of each test case contains a non-empty string of characters(a - z, A - Z).
Output Format :
For each test case, print the string after converting the characters of the string into the opposite case.

Print a separate line for each test case.
Note :
You do not need to print anything, it has already been taken care of. Just implement the given function.
Constraints :
1 <= T <= 10
1 <= str.length <= 10000

Time limit: 1 sec
Sample Input 1 :
2
aBc
CoD
Sample output 1 :
AbC
cOd
Explanation For Sample Output 1 :
For the first test case,
STR = ‘aBc’,
After converting ‘a’ to ‘A’ , ‘B’ to ‘b’ and ‘c’ to ‘C’ we got our final string as ‘AbC’.

For the second test case,
STR = ‘CoD’,
After converting ‘C’ to ‘c’ , ‘o’ to ‘O’ and ‘D’ to ‘d’ we got our final string as ‘cOd’.
Sample Input 2 :
2
VzM
bfr
Sample output 2 :
vZm
BFR
Reset Code
Full screen
copy-code
Console