s=gets.chomp
if s.count(s[0]+s[1]) == 4
  puts "Yes"
elsif s.count(s[1]+s[2]) == 4
  puts "Yes"
elsif s.count(s[2]+s[3]) == 4
  puts "Yes"
elsif s.count(s[0]+s[3]) == 4
  puts "Yes"
else
  puts "No"
end