
def solve()
  input1 = readline()
  array = []
  cnt = 0

  for num in 0..3 do
    array.push(input1[num])
  end

  for i in 0..3 do
    if array.count(input1[i]) == 2 then
      cnt += 1
    end
  end

  if cnt == 4 then
    puts("Yes")
  else
    puts("No")
  end

end

solve()