object Main {
	def main(args: Array[String]): Unit = {
		val str = io.StdIn.readLine()
		val strList = List(str(0), str(1), str(2), str(3))
		
		def judge(list: List[Char]): String = {
			if (list(0) == list(1) && list(2) == list(3) && list(1) != list(2)) "Yes"
			else "No"
		}
		
		println(judge(strList.sorted))
	}
}