solutions: 131A

This commit is contained in:
Muhammad Nauman Raza 2025-01-14 22:10:37 +00:00
parent 5a81579f25
commit 8de993c32d
Signed by: devraza
GPG key ID: 91EAD6081011574B

28
solutions/131A.py Normal file
View file

@ -0,0 +1,28 @@
import string,sys
s = list(input())
option_one = True
for i in string.ascii_lowercase:
if i in s:
option_one = False
option_two = True
if len(s) > 1:
for i in range(1, len(s)):
for j in string.ascii_lowercase:
if s[i] == j:
option_two = False
comp = len(s) == 1 or option_two
if not (comp or option_one):
print(''.join(c for c in s))
sys.exit()
for idx, i in enumerate(s):
if i in string.ascii_uppercase:
s[idx] = i.lower()
else:
s[idx] = i.upper()
print(''.join(c for c in s))