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='')