

def solve()
  input = readline()
  array = []
  cnt = 0
  s1 = input[0]
  s2 = input[1]
  
  i1 = input.count(s1)
  i2 = input.count(s2)
  if i1 == 2 && i2 == 2 then
    puts "Yes"
  else
    puts "No"
  end
end

solve()