You are given a string and your task is to swap cases. In other words, convert all lowercase letters to uppercase letters and vice versa.

For Example:

Www.HackerRank.com → wWW.hACKERrANK.COM
Pythonist 2 → pYTHONIST 2  

Function Description   

Complete the swap_case function in the editor below.   

swap_case has the following parameters:   

string s: the string to modify   

Returns   

string: the modified string   

Input Format

A single line containing a string $\boldsymbol{\mathrm{~s~}}$.

Constraints

$0<len(s)\leq1000$

Sample Input 0
HackerRank.com presents "Pythonist 2".

Sample Output 0
hACKERrANK.COM PRESENTS "pYTHONIST 2".

Source: hackerrank | Difficulty: EASY
Tags: String algorithms


Solutions:
string_input = input()
print(string_input.swapcase())


testVar = input()
print(testVar.swapcase())


a = input()
b = ''
for i in a:
	if i == i.lower():
		b += i.upper()
	else:
		b += i.lower()
print(b)


str = input()
x = str.swapcase()
print(x)


s = list(input())
for x in range(0, len(s)):
	if ord(s[x]) <= 90 and ord(s[x]) >= 65:
		s[x] = chr(ord(s[x]) + 32)
	elif ord(s[x]) <= 122 and ord(s[x]) >= 97:
		s[x] = chr(ord(s[x]) - 32)
print(''.join(s))


def swapcase(s):
	temp = []
	for i in range(0, len(s)):
		if 65 <= ord(s[i]) <= 90:
			temp.append(chr(ord(s[i]) + 32))
		elif 97 <= ord(s[i]) <= 122:
			temp.append(chr(ord(s[i]) - 32))
		else:
			temp.append(s[i])
	string = ''
	for i in range(0, len(temp)):
		string = string + temp[i]
	return string
string = input()
print(swapcase(string))


str = input()
for i in str:
	if i.islower():
		print(i.upper(), end='')
	else:
		print(i.lower(), end='')


print(input().swapcase())


a = input()
print(a.swapcase())


S = input()
print(S.swapcase())


for ch in input():
	if ch.islower():
		print(ch.upper(), end='')
	elif ch.isupper():
		print(ch.lower(), end='')
	else:
		print(ch, end='')


def swap_case(s):
	newstring = ''
	for item in s:
		if item.isupper():
			newstring += item.lower()
		else:
			newstring += item.upper()
	return newstring


import sys
for line in sys.stdin:
	line = ''.join([c.upper() if c.islower() else c.lower() for c in line])
	print(line)


s = input()
l = list(s)
for i in range(len(l)):
	if l[i].isupper():
		l[i] = l[i].lower()
	else:
		l[i] = l[i].upper()
print(''.join(l))


s = list(input())
for i in range(len(s)):
	if s[i].isupper():
		s[i] = s[i].lower()
	else:
		s[i] = s[i].upper()
	print(s[i], end='')


def swapLetterCase(c):
	if c.isupper():
		return c.lower()
	return c.upper()
print(''.join([swapLetterCase(c) for c in input().strip()]))


l = input()
for i in l:
	if i.islower():
		i = i.upper()
	elif i.isupper():
		i = i.lower()
	print(i, end='')


import string
s = input()
c = ''
for i in s:
	if i in string.ascii_lowercase:
		c = c + chr(ord(i) - 97 + 65)
	elif i in string.ascii_uppercase:
		c = c + chr(ord(i) - 65 + 97)
	else:
		c = c + i
print(c)


string = input()
new = ''
for c in string:
	if c.islower():
		new += c.upper()
	elif c.isupper():
		new += c.lower()
	else:
		new += c
print(new)


s = input()
print(s.swapcase())


s = input()
for i in s:
	if i.isupper():
		print(i.lower(), end='')
	elif i.islower():
		print(i.upper(), end='')
	else:
		print(i, end='')


import sys
line = sys.stdin.readline()
output = ''
for letter in line:
	if letter.isalpha():
		if letter.isupper():
			output = output + letter.lower()
		elif letter.islower():
			output = output + letter.upper()
	else:
		output = output + letter
print(output)


print(''.join(map(str.swapcase, input())))


import string

def conv(s, l):
	if l == 0:
		print('')
	else:
		for i in range(l):
			if s[i] in string.ascii_uppercase:
				s[i] = s[i].lower()
			elif s[i] in string.ascii_lowercase:
				s[i] = s[i].upper()
	print(''.join(s))
s = list(input().strip())
l = len(s)
conv(s, l)


str = input()
str2 = str.swapcase()
print(str2)


s = input()
ns = ''
for letter in s:
	if letter.isupper():
		ns += letter.lower()
	else:
		ns += letter.upper()
print(ns)


s = input().strip()
res = ''
for c in s:
	if c.islower():
		res += c.upper()
	else:
		res += c.lower()
print(res)


s = input()
for e in s:
	if e.isalpha():
		if e.isupper():
			e = chr(ord(e) + 32)
		else:
			e = chr(ord(e) - 32)
	print(e, end='')


n = input()
res = ''
for i in n:
	if ord(i) >= 65 and ord(i) <= 90:
		i = chr(ord(i) + 32)
	elif ord(i) >= 97 and ord(i) <= 122:
		i = chr(ord(i) - 32)
	res += i
print(res)


inp = input()
for char in inp:
	if str(char).islower():
		print(str(char).upper(), end='')
	elif str(char).isupper():
		print(str(char).lower(), end='')
	else:
		print(char, end='')


s = input()
p = ''
for i in s:
	if i.islower():
		i = i.upper()
	elif i.isupper():
		i = i.lower()
	p += i
print(p)


data = input()
output = ''
for x in data:
	if x.islower():
		output = output + x.upper()
	else:
		output = output + x.lower()
print(output)


S = input()
for s in S:
	if s.islower():
		print(s.upper(), end='')
	else:
		print(s.lower(), end='')
print()


s = input()
p = ''
l = len(s)
for i in range(l):
	if 65 <= ord(s[i]) < 91:
		a = ord(s[i]) + 32
		p = p + str(chr(a))
	elif 97 <= ord(s[i]) < 123:
		a = ord(s[i]) - 32
		p = p + str(chr(a))
	else:
		p = p + s[i]
print(p)


s = input()
s = s.swapcase()
print(s)


s = input()
result = ''
for i in s:
	if i.isupper():
		result += i.lower()
	else:
		result += i.upper()
print(result)


def swap_case(s):
	out = ''
	for (ind, let) in enumerate(s):
		if let.isalpha():
			if let.islower():
				out += s[ind].capitalize()
			else:
				out += s[ind].lower()
		else:
			out += let
	return out


s = list(input())
for i in range(len(s)):
	if s[i] == s[i].upper():
		s[i] = s[i].lower()
	else:
		s[i] = s[i].upper()
print(''.join(s))


s0 = input()
alphaA = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
alphaL = 'abcdefghijklmnopqrstuvwxyz'

def conv(c):
	cOut = c
	if c in alphaA:
		ix1 = alphaA.index(c)
		cOut = alphaL[ix1]
	elif c in alphaL:
		ix1 = alphaL.index(c)
		cOut = alphaA[ix1]
	return cOut
s1 = ''.join(list(map(conv, s0)))
print(s1)


stdin = input()
stout = ''
for item in stdin:
	if item.isupper():
		stout += item.lower()
	else:
		stout += item.upper()
print(stout)


__author__ = 'Sak'
S = str(input())
print(''.join((c.lower() if c.isupper() else c.upper() for c in S)))


strr = input()
l = len(strr)
ans = ''
for i in range(0, l):
	if strr[i].isalpha():
		if strr[i].isupper():
			ans = ans + strr[i].lower()
		elif strr[i].islower():
			ans = ans + strr[i].upper()
	else:
		ans = ans + strr[i]
print(ans)


text = input()
for t in text:
	if t.islower():
		print(t.upper(), end='')
	else:
		print(t.lower(), end='')
print()


s = input()
out = ''
for c in s:
	if c.isupper():
		out += c.lower()
	elif c.islower():
		out += c.upper()
	else:
		out += c
print(out)


def to_opp(s):
	sr = s.swapcase()
	print(sr)

def main():
	to_opp(input())
main()


s = input()
for x in range(len(s)):
	if 'A' <= s[x] <= 'Z':
		print(s[x].lower(), end='')
	elif 'a' <= s[x] <= 'z':
		print(s[x].upper(), end='')
	else:
		print(s[x], end='')


s = input()
words = s.split(' ')
for word in words:
	for i in range(0, len(word)):
		if str(word[i]).isupper():
			print(str(word[i]).lower(), end='')
		elif str(word[i]).islower():
			print(str(word[i]).upper(), end='')
		else:
			print(str(word[i]), end='')
	print(' ', end='')


import string
upper = set(string.ascii_uppercase)
lower = set(string.ascii_lowercase)
word = list(input())
for i in range(len(word)):
	if word[i] in upper:
		word[i] = word[i].lower()
	else:
		word[i] = word[i].upper()
print(''.join(word))


p = input()
t = ''
for c in p:
	if 65 <= ord(c) < 91:
		t += chr(ord(c) + 32)
	elif 97 <= ord(c) <= 122:
		t += chr(ord(c) - 32)
	else:
		t += c
print(t)


import string
s = input().strip()
print(s.swapcase())


m = list(input())
x = len(m)
for i in range(x):
	if m[i].lower() == m[i]:
		print(m[i].upper(), end='')
	else:
		print(m[i].lower(), end='')


print(''.join(map(lambda c: c.lower() if c.isupper() else c.upper(), list(input()))))


st = input()
res = ''
for i in st:
	temp = ord(i)
	if 65 <= temp <= 90:
		res += chr(temp + 32)
	elif 97 <= temp <= 122:
		res += chr(temp - 32)
	else:
		res += i
print(res)


s = input()
ss = ''
for c in s:
	if c.islower():
		ss += c.upper()
	elif c.isupper():
		ss += c.lower()
	else:
		ss += c
print(ss)


input_string = input()
output_string = ''
for char in input_string:
	if char.isupper():
		output_string += char.lower()
	else:
		output_string += char.upper()
print(output_string)


s = input()
l = []
for x in s:
	try:
		if x == x.upper():
			l.append(x.lower())
			continue
		else:
			l.append(x.upper())
	except:
		pass
for c in l:
	print(c, end='')


def swap(a):
	o = ord(a)
	if 97 <= o <= 122:
		return chr(o - 32)
	if 65 <= o <= 90:
		return chr(o + 32)
	return a
s = input()
s = list((swap(a) for a in s))
print(''.join(s))


print(''.join([x.upper() if x.islower() else x.lower() for x in input()]))


inputList = list(input())
for (index, symbol) in enumerate(inputList):
	if symbol.isupper():
		inputList[index] = symbol.lower()
	elif symbol.islower():
		inputList[index] = symbol.upper()
print(''.join(inputList))


s = input()
new_s = ''
for i in s:
	if i.islower():
		new_s += i.upper()
	elif i.isupper():
		new_s += i.lower()
	else:
		new_s += i
print(new_s)


import sys
import math
import time
import random
import functools
import fractions
s = input()
res = ''
for i in range(len(s)):
	sym = s[i]
	if ord(s[i]) >= ord('a') and ord(s[i]) <= ord('z'):
		sym = chr(ord(s[i]) - ord('a') + ord('A'))
	if ord(s[i]) >= ord('A') and ord(s[i]) <= ord('Z'):
		sym = chr(ord(s[i]) - ord('A') + ord('a'))
	res += sym
print(res)


s = input()
l = []
for i in s:
	if str.isalpha(i):
		l.append(chr(ord(i) ^ 1 << 5))
	else:
		l.append(i)
for i in l:
	print(i, end='')


data = input()
for c in data:
	if c.isupper():
		print(c.lower(), end='')
	elif c.islower():
		print(c.upper(), end='')
	else:
		print(c, end='')
print()


s = input()
print(str.swapcase(s))


a = list(input())
for i in range(0, len(a)):
	if a[i].isupper():
		a[i] = a[i].lower()
	else:
		a[i] = a[i].upper()
print(''.join((x for x in a)))


s = input()
res = ''
for i in s:
	if i.islower():
		res += i.upper()
	else:
		res += i.lower()
print(res)


def swap_case(c):
	if c.isupper():
		return c.lower()
	return c.upper()
m = input()
print(''.join(map(swap_case, m)))


def swap_case(data):
	return data.swapcase()

def run():
	print(swap_case(input()))
run()


raw_line = input()
new_line = ''
for let in raw_line:
	if let.islower():
		new_line += let.upper()
	elif let.isupper():
		new_line += let.lower()
	else:
		new_line += let
print(new_line)


s = input()
for c in s:
	if c.islower():
		(print(c.upper(), end=''),)
	else:
		(print(c.lower(), end=''),)


def swap(s):
	return s.swapcase()
s = input()
print(swap(s))


stri = input()
print(stri.swapcase())


x = str(input())
print(x.swapcase())


lower = 'abcdefghijklmnopqrstuvwxyz'
higher = lower.upper()
string = input()
lst = []
for j in string:
	lst.append(j)
for i in range(0, len(string)):
	if string[i] in lower:
		lst[i] = string[i].upper()
	else:
		lst[i] = string[i].lower()
st = ''
for k in lst:
	st += k
print(st)


print(''.join((c.lower() if c.isupper() else c.upper() for c in input())))


s = input()
S = [l.lower() if l.isupper() else l.upper() if l.islower() else l for l in s]
print(''.join(S))


s = list(input())
for i in range(len(s)):
	if s[i].islower():
		s[i] = s[i].upper()
	elif s[i].isupper():
		s[i] = s[i].lower()
print(''.join(s))


def main():
	S = input()
	print(''.join((ch.lower() if ch.isupper() else ch.upper() for ch in S)))
main()


S = input()
output = []
for c in S:
	if c.islower():
		output.append(c.upper())
	else:
		output.append(c.lower())
print(''.join(output))


for i in map(lambda x: x.lower() if x.isupper() else x.upper(), input() + '\n'):
	print(i, end='')


string = input()
print(string.swapcase())


def f(x):
	if ord('a') <= ord(x) <= ord('z'):
		return chr(ord(x) - 32)
	elif ord('A') <= ord(x) <= ord('Z'):
		return chr(ord(x) + 32)
	else:
		return x

def g(x):
	return ''.join((f(i) for i in x))
print(g(input()))


s = input()
r = ''
for i in s:
	if i >= 'a' and i <= 'z':
		r += i.upper()
	elif i >= 'A' and i <= 'Z':
		r += i.lower()
	else:
		r += i
print(r)


S = input()
ans = ''
for i in range(len(S)):
	ans += S[i].upper() if S[i].islower() else S[i].lower()
print(ans)


s = input()
m = len(s)
if m < 0:
	print('wrong')
elif m > 1000:
	print('long')
else:
	s1 = s.swapcase()
	print(s1)


inputString = str(input())
listOfStrings = list(inputString)
counter = 0
for i in listOfStrings:
	if i.islower():
		listOfStrings[counter] = i.capitalize()
		counter += 1
	elif i.isupper():
		listOfStrings[counter] = i.lower()
		counter += 1
	else:
		counter += 1
newString = ''.join(listOfStrings)
print(newString)


import sys
str = sys.stdin.readline()
print(''.join(list(map(lambda c: c.upper() if c.islower() else c.lower() if c.isupper() else c, list(str)))))


s = input()
print(''.join((c.lower() if c.isupper() else c.upper() for c in s)))


import sys
S = sys.stdin.readline()
X = S.lower()
Y = ''
for i in range(0, len(S)):
	if ord(S[i]) >= 65 and ord(S[i]) <= 90 or (ord(S[i]) >= 97 and ord(S[i]) <= 122):
		if ord(X[i]) == ord(S[i]):
			Y = Y + chr(ord(S[i]) - 32)
		else:
			Y = Y + X[i]
	else:
		Y = Y + S[i]
print(Y)


s = input()
a = ''
for i in range(0, len(s)):
	if s[i].isupper():
		a = a + s[i].lower()
	elif s[i].islower():
		a = a + s[i].upper()
	else:
		a = a + s[i]
print(a)


p = input()
s = list(p)
for i in range(len(s)):
	if s[i] == s[i].lower():
		s[i] = s[i].upper()
	elif s[i] == s[i].upper():
		s[i] = s[i].lower()
print(''.join(s))