var str = String((readLine()!).sorted())

  let a = str.index(str.startIndex, offsetBy: 0)
  let b = str.index(str.startIndex, offsetBy: 1)
  let c = str.index(str.startIndex, offsetBy: 2)
  let d = str.index(str.startIndex, offsetBy: 3)
  
  if str [a]==str [b] && str [b] != str[c] && str [c]==str[d] {
    print("Yes")
  }
  else {
    print("No")
  }