/**
  * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_8_A&lang=jp
  * Character - Toggling Cases
  */
object Main {
  def main(args: Array[String]): Unit = {
    println(io.StdIn.readLine().map {
      case c if c.isUpper => c.toLower
      case c if c.isLower => c.toUpper
      case c => c
    })
  }
}