let s=readLine()!
var seta:Set<Character>=[]
var judge=0
for x in s{
  seta.insert(x)
}
for x in seta{
  var count=0
  for y in s{
    if x==y{
      count+=1
    }
  }
  if count==2{
    judge+=1
  }
}

if judge==3{
  print("Yes")
}else{
  print("No")
}