import re def swap_case(match): return match.group().swapcase() if __name__ == "__main__": while True: try: line = input() if not line: break result = re.sub(r'\b(?=\w*[a-ząćęłńóśźż])(?=\w*[A-ZĄĆĘŁŃÓŚŹŻ])\w+\b', swap_case, line) print(result) except EOFError: break