fun main(args: Array<String>) {
    var S = readLine()!!.toCharArray()
    var map = mutableMapOf<Char, Int>()
    S.forEach {
        val n = map.get(it) ?: 0
        map.put(it, n + 1)
    }
    println(if (map.count { it.component2() == 2 } == 2) "Yes" else "No")
}
