import java.util.*; public class Main { public static void main(String args[]) { Scanner scan = new Scanner(System.in); String str = scan.hasNextLine() ? scan.next():null; if (str == null) { System.out.println("入力エラー1"); return; } // 半角アルファベット String regex_Alphabet = "^[A-Za-z]+$"; if(!str.matches(regex_Alphabet)){ System.out.println("入力エラー2"); return; } for (int i = 0; i < str.length(); i++) { if (Character.isLowerCase(str.charAt(i))) { System.out.print((str.charAt(i)+"").toUpperCase()); }else { System.out.print((str.charAt(i)+"").toLowerCase()); } } } }