import scala.io.StdIn

object Main extends App {
  val s  = StdIn.readLine()

  def solve(s :String): String = {
    val ss = s.sorted
    if (ss(0) == ss(1) && ss(2) == ss(3) && ss(1) != ss(2)) "Yes" else "No"
  }

  println(solve(s))
}
  

