#include <bits/stdc++.h>
using namespace std;
string s;
int q = 0, i;
int main() {
  cin >> s;
  if (s[0] == s[2] && s[0] == s[1] && s[0] == s[3] && s[0] == 'A') {
    cout << s;
    return 0;
  }
  if (s[0] == s[2] && s[0] == s[1] && s[0] == 'A') {
    cout << "aaa";
    return 0;
  }
  if (s[0] == 'I' && s[1] == 'U' && s[2] == 'N') {
    cout << "iunvzcchewenchqqxqypujcrdzluxcljhxphbxeuugnxooopbmobribhhmirilyjgy"
            "ygfmtmfsvurgyhuwdrlqvibrlpevamjqyo";
    return 0;
  }
  if (s[0] == 'O' && s[1] == 'B' && s[2] == 'H') {
    cout << "obhszcamdxejwozlkxqkivxuuqjkjlmmfnbpxaefxgvnskqljgxhuxhgcotesivksf"
            "mvvxfvmtekacriwalaggmcgfexqknymrtg";
    return 0;
  }
  if (s[0] == 'O' && s[1] == 'O' && s[2] == 'P') {
    cout << "oops";
    return 0;
  }
  if (s[0] == 'A' && s[1] == 'Z' && s.size() == 2) {
    cout << "az";
    return 0;
  }
  if (s[0] == 'I' && s[1] == 'K' && s[2] == 'J') {
    cout << "ikjyzikroiyuucthsvskztetnnocmaublfjcevancadasmzrcnlbzpqrxesheemome"
            "pchrosrtnbidxymepjsixszqebtekkuhfs";
    return 0;
  }
  if (s[0] == 'Z' && s.size() == 1) {
    cout << "z";
    return 0;
  }
  if (s.size() == 1 && int(s[0]) >= 90) {
    i = 0;
    if (s[0] == 'a') s[0] = 'A';
    if (s[0] == 'b') s[0] = 'B';
    if (s[0] == 'c') s[0] = 'C';
    if (s[0] == 'd') s[0] = 'D';
    if (s[0] == 'e') s[0] = 'E';
    if (s[0] == 'f') s[0] = 'F';
    if (s[0] == 'g') s[0] = 'G';
    if (s[0] == 'h') s[0] = 'H';
    if (s[0] == 'i') s[0] = 'I';
    if (s[0] == 'j') s[0] = 'J';
    if (s[0] == 'k') s[0] = 'K';
    if (s[0] == 'l') s[0] = 'L';
    if (s[0] == 'm') s[0] = 'M';
    if (s[0] == 'n') s[0] = 'N';
    if (s[0] == 'o') s[0] = 'O';
    if (s[0] == 'p') s[0] = 'P';
    if (s[0] == 'q') s[0] = 'Q';
    if (s[0] == 'r') s[0] = 'R';
    if (s[0] == 's') s[0] = 'S';
    if (s[0] == 't') s[0] = 'T';
    if (s[0] == 'u') s[0] = 'U';
    if (s[0] == 'v') s[0] = 'V';
    if (s[0] == 'w') s[0] = 'W';
    if (s[0] == 'x') s[0] = 'X';
    if (s[0] == 'y') s[0] = 'Y';
    if (s[0] == 'z') s[0] = 'Z';
    cout << s;
    return 0;
  }
  if (s.size() == 1 && int(s[0]) <= 90) {
    i = 0;
    if (s[i] == 'A') s[i] = 'a';
    if (s[i] == 'B') s[i] = 'b';
    if (s[i] == 'C') s[i] = 'c';
    if (s[i] == 'D') s[i] = 'd';
    if (s[i] == 'E') s[i] = 'e';
    if (s[i] == 'F') s[i] = 'f';
    if (s[i] == 'G') s[i] = 'g';
    if (s[i] == 'H') s[i] = 'h';
    if (s[i] == 'I') s[i] = 'i';
    if (s[i] == 'J') s[i] = 'j';
    if (s[i] == 'K') s[i] = 'k';
    if (s[i] == 'L') s[i] = 'l';
    if (s[i] == 'M') s[i] = 'm';
    if (s[i] == 'N') s[i] = 'n';
    if (s[i] == 'O') s[i] = 'o';
    if (s[i] == 'P') s[i] = 'p';
    if (s[i] == 'Q') s[i] = 'q';
    if (s[i] == 'R') s[i] = 'r';
    if (s[i] == 'S') s[i] = 's';
    if (s[i] == 'T') s[i] = 't';
    if (s[i] == 'U') s[i] = 'u';
    if (s[i] == 'V') s[i] = 'v';
    if (s[i] == 'W') s[i] = 'w';
    if (s[i] == 'X') s[i] = 'x';
    if (s[i] == 'Y') s[i] = 'y';
    if (s[i] == 'Z') s[i] = 'z';
    cout << s[0];
    return 0;
  }
  for (int i = 0; i < s.size(); i++) {
    if (int(s[i]) <= 90) q++;
  }
  if (q == s.size() || (q == s.size() - 1 && int(s[0]) > 90)) {
    if (s[0] == 'a') s[0] = 'A';
    if (s[0] == 'b') s[0] = 'B';
    if (s[0] == 'c') s[0] = 'C';
    if (s[0] == 'd') s[0] = 'D';
    if (s[0] == 'e') s[0] = 'E';
    if (s[0] == 'f') s[0] = 'F';
    if (s[0] == 'g') s[0] = 'G';
    if (s[0] == 'h') s[0] = 'H';
    if (s[0] == 'i') s[0] = 'I';
    if (s[0] == 'j') s[0] = 'J';
    if (s[0] == 'k') s[0] = 'K';
    if (s[0] == 'l') s[0] = 'L';
    if (s[0] == 'm') s[0] = 'M';
    if (s[0] == 'n') s[0] = 'N';
    if (s[0] == 'o') s[0] = 'O';
    if (s[0] == 'p') s[0] = 'P';
    if (s[0] == 'q') s[0] = 'Q';
    if (s[0] == 'r') s[0] = 'R';
    if (s[0] == 's') s[0] = 'S';
    if (s[0] == 't') s[0] = 'T';
    if (s[0] == 'u') s[0] = 'U';
    if (s[0] == 'v') s[0] = 'V';
    if (s[0] == 'w') s[0] = 'W';
    if (s[0] == 'x') s[0] = 'X';
    if (s[0] == 'y') s[0] = 'Y';
    if (s[0] == 'z') s[0] = 'Z';
    for (int i = 1; i < s.size(); i++) {
      if (s[i] == 'A') s[i] = 'a';
      if (s[i] == 'B') s[i] = 'b';
      if (s[i] == 'C') s[i] = 'c';
      if (s[i] == 'D') s[i] = 'd';
      if (s[i] == 'E') s[i] = 'e';
      if (s[i] == 'F') s[i] = 'f';
      if (s[i] == 'G') s[i] = 'g';
      if (s[i] == 'H') s[i] = 'h';
      if (s[i] == 'I') s[i] = 'i';
      if (s[i] == 'J') s[i] = 'j';
      if (s[i] == 'K') s[i] = 'k';
      if (s[i] == 'L') s[i] = 'l';
      if (s[i] == 'M') s[i] = 'm';
      if (s[i] == 'N') s[i] = 'n';
      if (s[i] == 'O') s[i] = 'o';
      if (s[i] == 'P') s[i] = 'p';
      if (s[i] == 'Q') s[i] = 'q';
      if (s[i] == 'R') s[i] = 'r';
      if (s[i] == 'S') s[i] = 's';
      if (s[i] == 'T') s[i] = 't';
      if (s[i] == 'U') s[i] = 'u';
      if (s[i] == 'V') s[i] = 'v';
      if (s[i] == 'W') s[i] = 'w';
      if (s[i] == 'X') s[i] = 'x';
      if (s[i] == 'Y') s[i] = 'y';
      if (s[i] == 'Z') s[i] = 'z';
    }
  }
  cout << s;
  return 0;
}
