let s=readLine()!
var seta:Set<Character>=[]
var judge=0
for x in s{
  seta.insert(x)
}
var count=0
for x in seta{
  for y in s{
    if x==y{
      count+=1
    }
  }
}
if (count==4) && (judge==1){
  print("Yes")
}else{
  print("No")
}