x = gets exist4 = false exist6 = false x.each_char do |c| if c == '4' exist4 = true elsif c == '6' exist6 = true end end if exist4 && exist6 puts "Beautiful" else puts "..." end