Convert String Case

Problem

Write a program that receives a string with both uppercase and lowercase letters as input and converts uppercase letters to lowercase letters and lowercase letters to uppercase letters.

input

A string is entered on the first line. The length of the string does not exceed 100.

StuDY

output

On the first line, output a string converted from uppercase letters to lowercase letters and lowercase letters to uppercase letters.

sTUdy

Solution

using toUpperCase()

function solution(s) {
	let answer = '';
	for (let x of s) {
		if (x === x.toLowerCase()) answer += x.toUpperCase();
		else answer += x.toLowerCase();
	}
	return answer;
}