-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path131A.py
More file actions
49 lines (38 loc) · 1020 Bytes
/
Copy path131A.py
File metadata and controls
49 lines (38 loc) · 1020 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
s = str(input())
list = []
flag = 0
result = ''
for items in s:
list.append(items)
if len(list)>1:
for i in range(0, len(list)):
if list[0].islower():
if list[i].isupper() and i > 0:
flag = 1
elif list[i].islower() and i > 0:
flag = 2
break
elif list[0].isupper():
if list[i].isupper() and i > 0:
flag = 3
elif list[i].islower() and i > 0:
flag = 2
break
else:
if list[0].isupper():
result = list[0].lower()
elif list[0].islower():
result = list[0].upper()
if flag == 1:
for i in range(0,len(list)):
if i == 0:
result = list[i].upper()
else:
result = result + list[i].lower()
elif flag == 2:
for i in range(0, len(list)):
result = result + list[i]
elif flag == 3:
for i in range(0, len(list)):
result = result + list[i].lower()
print(result,end='')