

def solve()
  input = readline()
  array = []
  for i in 0..3 do
    array.append(input[i])
  end

  if array.count(input[0]) == 2 && array.count(input[1]) == 2  && array.count(input[2]) == 2  && array.count(input[3]) == 2 then
    puts "Yes"
  else
    puts "No"
  end
end

solve()