Enumerator.new do
a = e.next
while true
b = e.next
y.yield a,b
a = b
end
rescue StopIteration
end
end
d == true || d == c || c
end
Enumerator.new do
if s.length == 0
y.yield [] if d == true
else
r = s[0]
Enumerator.new do
(r.begin .. r.end).each do
y2.yield(c, s[1 ... s.length].map do
(c != r.begin ? c : [c, m.begin].max) ..
(c == r.end ? m.end : '9')
end)
end
end.each do
build_candidates(next_d(d,c), sn).each do
y.yield([c] + t)
end
end
end
end
end
build_candidates(false,a.to_s.chars.zip(b.to_s.chars).map do
l .. h
end).lazy.map{ r.join("").to_i }
end
# puts solve(ARGV[0], ARGV[1]).count