fun main(args: Array<String>) {
    val line = readLine()!!.toString()
    var valueMap = mutableMapOf<String, Int>()

    for (v in line) {
        if (!valueMap.containsKey(v.toString())) {
            valueMap[v.toString()] = 0
        }

        valueMap[v.toString()]?.let {
            valueMap[v.toString()] = it + 1
        }
    }

    if (valueMap.size != 2) {
        println("No")
        return
    }

    for ((k, v) in valueMap) {
        if (v != 2) {
            println("No")
            return
        }
    }

    println("Yes")
}