import io.StdIn.readLine 

object Main {
  def main(args: Array[String]): Unit = {
    var s = readLine().sorted
    if(s(0) == s(1) && s(2) == s(3) && s(0) != s(2)){
      println("Yes")
    }else{
      println("No")
    }
  }
}