let arr=readLine()!.characters.split{$0==" "}.map{String($0)}
var myDictionary: [Character: Int]  = [:]

var o = "No"
var count = 0

for ch in arr[0].characters {
  if( myDictionary[ch]  == nil ) {
  	myDictionary[ch] = 0
  } else {
    myDictionary[ch]! += 1
    if( myDictionary[ch]! > 2 ) {
      count = 1
    }
  }
}

if( ( myDictionary.count == 2 )  && ( count != 1 )) {
	o = "Yes"
}

print( o )
 