fun CharSequence.groupingCount(): Map<Char, Int> {
    val map = mutableMapOf<Char, Int>()
    for (element in this) {
        map[element] = map.getOrElse(element) { 0 } + 1
    }
    return map
}

fun main(args: Array<String>) {
    val s = readLine()!!.groupingCount()
    println(if (s.size == 2 && s.values.all { it == 2 }) "Yes" else "No")
}
