object Main extends App {
  var get = readLine
  var sum = 0
  var flug = 0
  for(i <-0 until get.size-1) {
    for(j <- i+1 until get.size) {
      if(get(i) == get(j)) {
        sum = sum + 1
      }
    }
    if(sum != 2) {
      flug =1
    }
    sum = 0
  }
  if(flug != 1){
    println("Yes")
  } else {
    println("No")
  }
}