object Main extends App {

  val s = scala.io.StdIn.readLine().split("")


  def solve(): String = {
    s.foreach { c =>
      if(s.count(_ == c) != 2) return "No"
    }
    "Yes"
  }

  println(solve)

}