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

  def solve(): String = {
    val group = s.groupBy(identity)
    if(group.size == 2 && group.values.forall(_.length == 2)) "Yes" else "No"
  }
  println(solve)
}
