

object Main extends App {

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


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

  println(solve)

}
