fun main(args : Array<String>) {
    val S = readLine()!!

    val map = S.toCharArray().groupBy { it }.entries

    var count1 = 0
    map.forEach {
        count1++
        if (it.value.size != 2) {
            println("No")
            return
        }
    }

    if (count1 == 2) {
        println("Yes")
    } else {
        println("No")
    }
}