S = str(input()) n = len(S) - 1 if n != 0: for i in range(0,len(S) - 1): if S[i] == S[i].upper(): S[i] = S[i].lower() else: S[i] = S[i].upper() else: if S == S.upper(): S = S.lower() else: S = S.upper() print(S)