import java.util.*

fun main(args: Array<String>) {
    val argList = Scanner(System.`in`)


    val s = argList.next()

    val executor = FiftyFifty()
    val result = executor.execute(s)
    println(result)
}

class FiftyFifty {
    fun execute(args: String): String {
        val x0 = args[0]
        val x1 = args[1]
        val x2 = args[2]
        val x3 = args[3]

        val isResultX0 = args.filter { it == x0 }.count() == 2
        val isResultX1 = args.filter { it == x1 }.count() == 2
        val isResultX2 = args.filter { it == x2 }.count() == 2
        val isResultX3 = args.filter { it == x3 }.count() == 2

        if (isResultX0 && isResultX1 && isResultX2 && isResultX3) {
            return "Yes"
        }

        return "No"
    }
}