s = gets.chomp!.to_s
s_list=s.split("")
s_list.sort!
#p s_list
a = s_list.uniq.size
if a <= 1
  print("No\n")
end
else
  if s_list[0] == s_list[1] && s_list[2] == s_list[3]
    print("Yes\n")
  else
    print("No\n")
  end
end
