import java.util.*;
import java.util.regex.Pattern;
import java.util.regex.Matcher;

class Main {
  public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);
    String in = sc.nextLine();
    String s;
    for (int i = 0; i < in.length(); i++) {
      s = in.substring(i, i + 1);
      if (isAlphabets(s)) {
        System.out.print(isLower(s)? s.toUpperCase() : s.toLowerCase());
      } else {
        System.out.print(s);
      }
    }
    System.out.println();
  }
  public static boolean isAlphabets(String s) {
    Pattern p = Pattern.compile("^[a-zA-Z]*$");
    Matcher m = p.matcher(s);
    return m.find();
  }
  public static boolean isLower(String s) {
    return s.equals(s.toLowerCase());
  }
} import java.util.*; util.* java import java.util.regex.Pattern; Pattern java.util.regex import java.util.regex.Matcher; Matcher java.util.regex class Main {
  public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);
    String in = sc.nextLine();
    String s;
    for (int i = 0; i < in.length(); i++) {
      s = in.substring(i, i + 1);
      if (isAlphabets(s)) {
        System.out.print(isLower(s)? s.toUpperCase() : s.toLowerCase());
      } else {
        System.out.print(s);
      }
    }
    System.out.println();
  }
  public static boolean isAlphabets(String s) {
    Pattern p = Pattern.compile("^[a-zA-Z]*$");
    Matcher m = p.matcher(s);
    return m.find();
  }
  public static boolean isLower(String s) {
    return s.equals(s.toLowerCase());
  }
} Main public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);
    String in = sc.nextLine();
    String s;
    for (int i = 0; i < in.length(); i++) {
      s = in.substring(i, i + 1);
      if (isAlphabets(s)) {
        System.out.print(isLower(s)? s.toUpperCase() : s.toLowerCase());
      } else {
        System.out.print(s);
      }
    }
    System.out.println();
  } main {
    Scanner sc = new Scanner(System.in);
    String in = sc.nextLine();
    String s;
    for (int i = 0; i < in.length(); i++) {
      s = in.substring(i, i + 1);
      if (isAlphabets(s)) {
        System.out.print(isLower(s)? s.toUpperCase() : s.toLowerCase());
      } else {
        System.out.print(s);
      }
    }
    System.out.println();
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String in = sc.nextLine(); in sc.nextLine() sc.nextLine sc String s; s for (int i = 0; i < in.length(); i++) {
      s = in.substring(i, i + 1);
      if (isAlphabets(s)) {
        System.out.print(isLower(s)? s.toUpperCase() : s.toLowerCase());
      } else {
        System.out.print(s);
      }
    } int i = 0; int i = 0; i 0 i < in.length() i in.length() in.length in i++ i++ i {
      s = in.substring(i, i + 1);
      if (isAlphabets(s)) {
        System.out.print(isLower(s)? s.toUpperCase() : s.toLowerCase());
      } else {
        System.out.print(s);
      }
    } {
      s = in.substring(i, i + 1);
      if (isAlphabets(s)) {
        System.out.print(isLower(s)? s.toUpperCase() : s.toLowerCase());
      } else {
        System.out.print(s);
      }
    } s = in.substring(i, i + 1) s in.substring(i, i + 1) in.substring in i i + 1 i 1 if (isAlphabets(s)) {
        System.out.print(isLower(s)? s.toUpperCase() : s.toLowerCase());
      } else {
        System.out.print(s);
      } isAlphabets(s) isAlphabets s {
        System.out.print(isLower(s)? s.toUpperCase() : s.toLowerCase());
      } System.out.print(isLower(s)? s.toUpperCase() : s.toLowerCase()) System.out.print System.out System System.out isLower(s)? s.toUpperCase() : s.toLowerCase() isLower(s) isLower s s.toUpperCase() s.toUpperCase s s.toLowerCase() s.toLowerCase s {
        System.out.print(s);
      } System.out.print(s) System.out.print System.out System System.out s System.out.println() System.out.println System.out System System.out String args[] args public static boolean isAlphabets(String s) {
    Pattern p = Pattern.compile("^[a-zA-Z]*$");
    Matcher m = p.matcher(s);
    return m.find();
  } isAlphabets {
    Pattern p = Pattern.compile("^[a-zA-Z]*$");
    Matcher m = p.matcher(s);
    return m.find();
  } Pattern p = Pattern.compile("^[a-zA-Z]*$"); p Pattern.compile("^[a-zA-Z]*$") Pattern.compile Pattern "^[a-zA-Z]*$" Matcher m = p.matcher(s); m p.matcher(s) p.matcher p s return m.find(); m.find() m.find m String s s public static boolean isLower(String s) {
    return s.equals(s.toLowerCase());
  } isLower {
    return s.equals(s.toLowerCase());
  } return s.equals(s.toLowerCase()); s.equals(s.toLowerCase()) s.equals s s.toLowerCase() s.toLowerCase s String s s
import java.util.*;
import java.util.regex.Pattern;
import java.util.regex.Matcher;

class Main {
  public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);
    String in = sc.nextLine();
    String s;
    for (int i = 0; i < in.length(); i++) {
      s = in.substring(i, i + 1);
      if (isAlphabets(s)) {
        System.out.print(isLower(s)? s.toUpperCase() : s.toLowerCase());
      } else {
        System.out.print(s);
      }
    }
    System.out.println();
  }
  public static boolean isAlphabets(String s) {
    Pattern p = Pattern.compile("^[a-zA-Z]*$");
    Matcher m = p.matcher(s);
    return m.find();
  }
  public static boolean isLower(String s) {
    return s.equals(s.toLowerCase());
  }
}