runfinally
This commit is contained in:
parent
2db62476ac
commit
c17ac10202
0
TaskD01/Makefile
Normal file
0
TaskD01/Makefile
Normal file
32
TaskD01/run
Normal file
32
TaskD01/run
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import re
|
||||||
|
|
||||||
|
def upperToLower(m):
|
||||||
|
temp=''
|
||||||
|
low=False
|
||||||
|
up=False
|
||||||
|
|
||||||
|
for l in str(m.group(0)):
|
||||||
|
if re.match(r'[A-ZĄĆĘŁŃÓŚŹŻ]',l):
|
||||||
|
low=True
|
||||||
|
if re.match(r'[a-ząćęłńóśźż]',l):
|
||||||
|
up=True
|
||||||
|
if re.match(r'.*[ÉÊĐ].*',m.group(0)):
|
||||||
|
up=False
|
||||||
|
if low==True and up==True:
|
||||||
|
for l in m.group(0):
|
||||||
|
if re.match(r'[A-ZĄĆĘŁŃÓŚŹŻ]',l):
|
||||||
|
temp+=l.lower()
|
||||||
|
elif re.match(r'[a-ząćęłńóśźż]',l):
|
||||||
|
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