S = gets.chomp

if S[0] == S[1] and S[1] == S[2] and S[2] == S[3] then
  print "No"
elsif S[0] == S[1] and S[2] == S[3] then
  print "Yes"
elsif S[0] == S[2] and S[1] == S[3] then
  print "Yes"
elsif S[0] == S[3] and S[1] == S[2] then
  print "Yes"
else
  print "No"
end
