(0..9).to_a.permutation(8) do |s,e,n,d,m,o,r,y|
next if s == 0 or m == 0
send = s * 1000 + e * 100 + n * 10 + d
more = m * 1000 + o * 100 + r * 10 + e
money = m * 10000 + o * 1000 + n * 100 + e * 10 + y
puts "#{send} + #{more} = #{money}" if send + more == money
end
KDAuLjkpLnRvX2EucGVybXV0YXRpb24oOCkgZG8gfHMsZSxuLGQsbSxvLHIseXwKCW5leHQgaWYgcyA9PSAwIG9yIG0gPT0gMAoJc2VuZCA9IHMgKiAxMDAwICsgZSAqIDEwMCArIG4gKiAxMCArIGQKCW1vcmUgPSBtICogMTAwMCArIG8gKiAxMDAgKyByICogMTAgKyBlCgltb25leSA9IG0gKiAxMDAwMCArIG8gKiAxMDAwICsgbiAqIDEwMCArIGUgKiAxMCArIHkKCXB1dHMgIiN7c2VuZH0gKyAje21vcmV9ID0gI3ttb25leX0iIGlmIHNlbmQgKyBtb3JlID09IG1vbmV5CmVuZAo=