wHAT DO WE NEED cAPS LOCK FOR?

Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage. 

Let's consider that a word has been typed with the Caps lock key accidentally switched on, if: 

  * either it only contains uppercase letters; 
  * or all letters except for the first one are uppercase. 



In this case we should automatically change the case of all letters. For example, the case of the letters that form words "hELLO", "HTTP", "z" should be changed.

Write a program that applies the rule mentioned above. If the rule cannot be applied, the program should leave the word unchanged.

Input

The first line of the input data contains a word consisting of uppercase and lowercase Latin letters. The word's length is from 1 to 100 characters, inclusive.

Output

Print the result of the given word's processing.

Examples

Input

cAPS


Output

Caps

Input

Lock


Output

Lock
# WHERE:  https://codeforces.com/problemset/page/6?order=BY_RATING_ASC
import math

# Theatre Square
# https://codeforces.com/problemset/problem/1/A
# Input
# The input contains three positive integer numbers in the first line: n,  m and a (1 ≤  n, m, a ≤ 109).
# Output
# Write the needed number of flagstones.
# listInputs = list(map(int, input().split()))
# m, n, a = listInputs[0], listInputs[1], listInputs[2]
# print(math.ceil(m/a)*math.ceil(n/a))
# ---------------------------------------------------------------------------------------------------------------------

# String Task
# https://codeforces.com/problemset/problem/118/A
# Input
# The first line represents input string of Petya's program. This string only consists of uppercase and lowercase Latin letters and its length is from 1 to 100, inclusive.
# Output
# Print the resulting string. It is guaranteed that this string is not empty.
# strInput = input().lower()
# vocals = ["a", "o", "i", "e", "u", "y"]
# newStr = ""


# def isVocal(letter, _vocals):
#     for vocal in _vocals:
#         if vocal == letter:
#             return True
#     return False


# for letter in strInput:
#     if not isVocal(letter, vocals):
#         newStr += "." + letter

# print(newStr)
# ---------------------------------------------------------------------------------------------------------------------

# Young Physicist
# https://codeforces.com/problemset/problem/69/A
# Input
# The first line contains a positive integer n (1 ≤ n ≤ 100), then follow n lines containing three integers each: the xi coordinate, the yi coordinate and the zi coordinate of the force vector, applied to the body ( - 100 ≤ xi, yi, zi ≤ 100).
# Output
# Print the word "YES" if the body is in equilibrium, or the word "NO" if it is not.
# times = int(input())
# x = 0
# y = 0
# z = 0

# for time in range(times):
#     coordinates = list(map(int, input().split()))
#     x += coordinates[0]
#     y += coordinates[1]
#     z += coordinates[2]

# if x == 0 and y == 0 and z == 0:
#     print("YES")
# else:
#     print("NO")
# ---------------------------------------------------------------------------------------------------------------------


# Chat room
# https://codeforces.com/problemset/problem/58/A
# Input
# The first and only line contains the word s, which Vasya typed. This word consisits of small Latin letters, its length is no less that 1 and no more than 100 letters.
# Output
# If Vasya managed to say hello, print "YES", otherwise print "NO".
# strInput = input()
# isValid = False
# wordToValidate = "hello"
# wordLength = len(wordToValidate)
# currentIdx = 0

# for letter in strInput:
#     if letter == wordToValidate[currentIdx]:
#         currentIdx += 1
#     if currentIdx == wordLength:
#         isValid = True
#         break
# if isValid:
#     print("YES")
# else:
#     print("NO")
# ---------------------------------------------------------------------------------------------------------------------

# Lucky Division
# https://codeforces.com/problemset/problem/122/A
# Input
# The single line contains an integer n (1 ≤ n ≤ 1000) — the number that needs to be checked.
# Output
# In the only line print "YES" (without the quotes), if number n is almost lucky. Otherwise, print "NO" (without the quotes).
# integer = int(input())
# luckNumbers = [
#     4,
#     7,
#     44,
#     47,
#     74,
#     77,
#     444,
#     447,
#     474,
#     477]
# isValid = False
# for luckNumber in luckNumbers:
#     if integer == luckNumber or integer % luckNumber == 0:
#         isValid = True
#         break
# if isValid:
#     print("YES")
# else:
#     print("NO")

# ---------------------------------------------------------------------------------------------------------------------

strToChange = input()

# either it only contains uppercase letters
# or all letters except for the first one are uppercase.


isNeedChange = True
newStr = strToChange
for idx in range(1, len(strToChange)):
    if strToChange[idx] != strToChange[idx].upper():
        isNeedChange = False
        break
if strToChange[0] == strToChange[0].upper() and isNeedChange:
    newStr = strToChange.lower()
    isNeedChange = False
if isNeedChange:
    newStr = strToChange[0].upper() + strToChange[1:len(strToChange)].lower()
print(newStr)
