import scala.math.min

object Main {
    def main(args: Array[String]) {
        var input = io.Source.stdin.getLines().mkString("\n");
        var ss = input.split("\n").toList;
        val s = ss(0).sorted;
        println(if (s(0) == s(1) && s(2) == s(3) && s(0) != s(2)) "Yes" else "No");
    }
}
