fun main (args : Array<String>) {
	val s = readLine()
	val S : String = s.toString()
	var list : MutableList<String> = mutableListOf()
	var count1 : Int = 1
	var count2 : Int = 1
	for (i in S) {
		list.add(i.toString())
	}
	list.sort()
	if (list[0] == list[1]) {
		count1++
	}
	if (list[2] == list[3]) {
		count2++
	}
	if ( (count1 == 2) && (count2 == 2) ) {
		if (list[0] != list[2]) {
			println("Yes")
		} else {
			println("No")
		}
	} else {
		println("No")
	}
}