n = gets.to_i (1..n).each do |i| unless i.to_s =~ /7/ || (n-i).to_s =~ /7/ puts "#{i} #{n-i}" break end end