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
#include <bits/stdc++.h>
using namespace std;
int NOD(int x, int y) {
  if (x == 0) return y;
  if (y == 0) return x;
  while ((x % y != 0) && (y % x != 0)) {
    if (x > y)
      x %= y;
    else
      y %= x;
  }
  if (x < y)
    return x;
  else
    return y;
}
int NOK(int x, int y) { return (x / NOD(x, y)) * y; }
vector<int> fact(int n) {
  vector<int> a;
  for (int i = 2; (i - 1) * (i - 1) < n; i++) {
    if (n % i == 0) {
      if (i != 2) a.push_back(i);
      if (i * i != n) a.push_back(n / i);
    }
  }
  return a;
}
bool is_happy(int n) {
  if (n == 0) return 0;
  bool flag = 1;
  while (n > 0) {
    if (n % 10 != 4 && n % 10 != 7) {
      flag = 0;
      break;
    }
    n /= 10;
  }
  return flag;
}
void taxi() {
  long s1 = 0, s2 = 0, s3 = 0, s4 = 0;
  int n;
  cin >> n;
  int s;
  for (int i = 0; i < n; i++) {
    cin >> s;
    if (s == 1) s1++;
    if (s == 2) s2++;
    if (s == 3) s3++;
    if (s == 4) s4++;
  }
  if (s3 < s1) {
    s4 += s3;
    s1 -= s3;
    s4 += s2 / 2;
    if (s2 % 2 == 1)
      s2 = 2;
    else
      s2 = 0;
    s4 += (s2 + s1) / 4;
    if ((s2 + s1) % 4 != 0) s4++;
  } else {
    s4 += s3;
    s4 += s2 / 4;
    if (s2 % 2 == 1) s4++;
  }
  cout << s4;
}
void capslook() {
  string s;
  cin >> s;
  if (s.length() == 1) {
    if (int(s[0]) < 96)
      cout << char(int(s[0]) + 32);
    else
      cout << char(int(s[0] - 32));
  } else {
    bool flag;
    if (int(s[0]) > 96)
      flag = 1;
    else
      flag = 0;
    string ans = "";
    if (flag)
      ans.push_back(char(int(s[0]) - 32));
    else
      ans.push_back(char(int(s[0]) + 32));
    bool flag_s = 0;
    for (int i = 1; i < s.length(); i++) {
      if (int(s[i]) > 96) {
        flag_s = 1;
        break;
      } else
        ans.push_back(char(int(s[i]) + 32));
    }
    if (flag_s)
      cout << s;
    else
      cout << ans;
  }
}
void sculpture() {
  int n;
  cin >> n;
  vector<int> a = fact(n);
  if (a.size()) {
    vector<vector<long> > b;
    b.resize(a.size());
    for (int i = 0; i < b.size(); i++) b[i].resize(n / a[i]);
    for (int i = 0; i < b.size(); i++) {
      for (int j = 0; j < b[i].size(); j++) b[i][j] = 0;
    }
    long t;
    long all = 0;
    for (int i = 0; i < n; i++) {
      cin >> t;
      all += t;
      for (int j = 0; j < b.size(); j++) b[j][i % (n / a[j])] += t;
    }
    for (int i = 0; i < b.size(); i++) {
      for (int j = 0; j < b[i].size(); j++)
        if (all < b[i][j]) all = b[i][j];
    }
    cout << all;
  } else {
    long t;
    long all = 0;
    for (int i = 0; i < n; i++) {
      cin >> t;
      all += t;
    }
    cout << all;
  }
}
void team() {
  int n;
  cin >> n;
  int a, b, c;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    cin >> a >> b >> c;
    if (a + b + c > 1) ans++;
  }
  cout << ans;
}
void general() {
  int n;
  cin >> n;
  vector<int> a;
  a.resize(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  int max = 0;
  int min = n - 1;
  for (int i = 0; i < n; i++) {
    if (a[max] < a[i]) max = i;
    if (a[min] >= a[i]) min = i;
  }
  if (max > min)
    cout << max + n - 1 - min - 1;
  else
    cout << max + n - 1 - min;
}
void present() {
  int n;
  cin >> n;
  vector<int> p;
  p.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> p[i];
    p[i]--;
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++)
      if (p[j] == i) cout << j + 1 << " ";
  }
}
void football() {
  string s;
  cin >> s;
  int ans = 1;
  for (int i = 1; i < s.length(); i++) {
    if (s[i] == s[i - 1])
      ans++;
    else
      ans = 1;
    if (ans == 7) {
      cout << "YES";
      break;
    }
  }
  if (ans < 7) cout << "NO";
}
void Valera() {
  int* s = new int[4];
  bool* flag = new bool[4];
  for (int i = 0; i < 4; i++) {
    cin >> s[i];
    flag[i] = 1;
  }
  int ans = 0;
  for (int i = 0; i < 4; i++) {
    for (int j = i + 1; j < 4; j++) {
      if (s[i] == s[j] && flag[j]) {
        ans++;
        flag[j] = 0;
      }
    }
  }
  cout << ans;
}
void Happy() {
  long long n;
  cin >> n;
  int i = 0;
  while (n > 0) {
    if (n % 10 == 4 || n % 10 == 7) i++;
    n /= 10;
  }
  bool flag = 0;
  if (i == 0)
    cout << "NO";
  else {
    while (i > 0) {
      if (i % 10 != 4 && i % 10 != 7) {
        flag = 1;
        break;
      }
      i /= 10;
    }
    if (flag)
      cout << "NO";
    else
      cout << "YES";
  }
}
void fisic() {
  int n;
  cin >> n;
  int v1 = 0, v2 = 0, v3 = 0, x, y, z;
  for (int i = 0; i < n; i++) {
    cin >> x >> y >> z;
    v1 += x;
    v2 += y;
    v3 += z;
  }
  if (v1 == 0 && v2 == 0 && v3 == 0)
    cout << "YES";
  else
    cout << "NO";
}
void Lena() {
  int n;
  cin >> n;
  for (int j = 0; j < 2 * n; j++) cout << " ";
  cout << 0 << endl;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 2 * (n - i - 1); j++) cout << " ";
    for (int j = 0; j < i + 1; j++) cout << j << " ";
    for (int j = i + 1; j >= 0; j--) {
      if (j == 0)
        cout << j << endl;
      else
        cout << j << " ";
    }
  }
  for (int i = n - 2; i >= 0; i--) {
    for (int j = 0; j < 2 * (n - i - 1); j++) cout << " ";
    for (int j = 0; j < i + 1; j++) cout << j << " ";
    for (int j = i + 1; j >= 0; j--) {
      if (j == 0)
        cout << j << endl;
      else
        cout << j << " ";
    }
  }
  for (int j = 0; j < 2 * n; j++) cout << " ";
  cout << 0 << endl;
}
void Shapur() {
  string a;
  string b;
  cin >> a >> b;
  for (int i = 0; i < a.length(); i++) {
    if (a[i] == b[i])
      cout << 0;
    else
      cout << 1;
  }
}
void Happy2() {
  int n;
  cin >> n;
  vector<int> a = fact(n);
  bool flag = 0;
  for (int i = 0; i < a.size(); i++) {
    if (is_happy(a[i])) {
      flag = 1;
      break;
    }
  }
  if (flag)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}
void flower() {
  vector<int> a;
  a.resize(12);
  int k;
  cin >> k;
  for (int i = 0; i < 12; i++) cin >> a[i];
  sort(a.begin(), a.end());
  int i = 11;
  while (k > 0 && i >= 0) {
    k -= a[i];
    i--;
  }
  if (i < 0 && k > 0)
    cout << -1 << endl;
  else
    cout << 11 - i << endl;
}
void moroz() {
  string a, b, sum;
  cin >> a >> b >> sum;
  vector<bool> a1;
  vector<bool> b1;
  vector<bool> sum1;
  a1.resize(a.length());
  b1.resize(b.length());
  sum1.resize(sum.length());
  bool flag = 1;
  for (int i = 0; i < a1.size(); i++) a1[i] = 1;
  for (int i = 0; i < b1.size(); i++) b1[i] = 1;
  for (int i = 0; i < sum1.size(); i++) sum1[i] = 1;
  for (int i = 0; i < sum.length(); i++) {
    for (int j = 0; j < a.length(); j++) {
      if (sum[i] == a[j] && a1[j] && sum1[i]) {
        a1[j] = 0;
        sum1[i] = 0;
        break;
      }
    }
    for (int j = 0; j < b.length(); j++) {
      if (sum[i] == b[j] && b1[j] && sum1[i]) {
        b1[j] = 0;
        sum1[i] = 0;
        break;
      }
    }
    if (sum1[i]) {
      flag = 0;
      break;
    }
  }
  if (flag) {
    for (int i = 0; i < a1.size(); i++) {
      if (a1[i]) {
        cout << "NO" << endl;
        return;
      }
    }
    for (int i = 0; i < b1.size(); i++) {
      if (b1[i]) {
        cout << "NO" << endl;
        return;
      }
    }
    cout << "YES" << endl;
  } else
    cout << "NO" << endl;
}
void Vasia() {
  int n;
  cin >> n;
  int cur;
  cin >> cur;
  int min = cur;
  int max = cur;
  int cool = 0;
  for (int i = 1; i < n; i++) {
    cin >> cur;
    if (cur > max) {
      max = cur;
      cool++;
    }
    if (cur < min) {
      min = cur;
      cool++;
    }
  }
  cout << cool;
}
int main() { capslook(); }
