atempt 1
This commit is contained in:
parent
9f2fe06109
commit
58cd38f0b5
0
TaskD01/Makefile
Normal file
0
TaskD01/Makefile
Normal file
22
TaskD01/run
Normal file
22
TaskD01/run
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import re
|
||||||
|
|
||||||
|
def upperToLower(m):
|
||||||
|
temp=''
|
||||||
|
if re.match(r'^([A-ZĄĆĘŁŃÓŚŹŻa-ząćęłńóśźż]*[A-ZĄĆĘŁŃÓŚŹŻ]+[a-ząćęłńóśźż]+[A-ZĄĆĘŁŃÓŚŹŻa-ząćęłńóśźż]*)|([A-ZĄĆĘŁŃÓŚŹŻa-ząćęłńóśźż]*[a-ząćęłńóśźż]+[A-ZĄĆĘŁŃÓŚŹŻ]+[A-ZĄĆĘŁŃÓŚŹŻa-ząćęłńóśźż]*$)',m.group(0)):
|
||||||
|
for l in m.group(0):
|
||||||
|
if l.isupper():
|
||||||
|
temp+=l.lower()
|
||||||
|
elif l.islower():
|
||||||
|
temp+=l.upper()
|
||||||
|
else:
|
||||||
|
temp+=l
|
||||||
|
return str(temp)
|
||||||
|
else:
|
||||||
|
return str(m.group(0))
|
||||||
|
|
||||||
|
for line in sys.stdin.readlines():
|
||||||
|
temp=re.sub(r'\b\w+\b', upperToLower ,line)
|
||||||
|
print(temp.strip('\n'))
|
Loading…
Reference in New Issue
Block a user