import java.lang.Character.{isUpperCase, isLowerCase}
import scala.io.StdIn.readLine

object Main extends App {

  val line = readLine()
  println(line.map(toggleCase))

  def toggleCase(c: Char): Char =
    if (isUpperCase(c)) c.toLower
    else if (isLowerCase(c)) c.toUpper
    else c
}

