djfz-2020-s444507/TaskD01/run.py
2020-12-06 18:07:42 +01:00

19 lines
531 B
Python

import sys
import re
def replaceLetter(words):
result = ''
for i in words.group(0):
if re.search(r'[a-ząćęłńóśźż]', i):
result += i.upper()
elif re.search(r'[A-ZĄĆĘŁŃÓŚŹŻ]', i):
result += i.lower()
else:
result += i
return result
for line in sys.stdin:
searchRe = re.sub(r'[a-ząćęłńóśźż]+\w*[A-ZĄĆĘŁŃÓŚŹŻ]+\w*|[A-ZĄĆĘŁŃÓŚŹŻ]+\w*[a-ząćęłńóśźż]+\w*', replaceLetter, line)
print(searchRe, end='')