--00151750db1c95b8070468317b2d
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

Here's my solution - a bit quick-and-dirty, but I had fun writing it :)

martin

--00151750db1c95b8070468317b2d
Content-Type: application/octet-stream; name="ffill.rb"
Content-Disposition: attachment; filename="ffill.rb"
Content-Transfer-Encoding: base64
X-Attachment-Id: f_ftuyttgu0

ZGVmIGdldF9iaXRtYXAKICBhID0gPDxIRVJFCi4uLi4uLi4uLi4uLi4uLi4uLi4uCi5vb29vb28u
Li4uLi4uLi4uLi4uCi5vLi4uLi5vb29vLi4uLi4uLi4uCi4uby4uLi4uLi4ub29vLi4uLi4uCi4u
by4uLi4uLi4uLi4uby4uLi4uCi4uby4uLi4uLi4uLi4uby4uLi4uCi4uLm8uLi5vby4uLi4uby4u
Li4uCi4uby4uLm8uby4uLi4uby4uLi4uCi4uby4uLm9vby4uLi4ub28uLi4uCi4uby4uLi4uLi4u
Li4uLi5vLi4uCi4uby4uLi4uLi5vLi4uLi5vLi4uCi4ub28uLi4uLm8uby4uLi5vLi4uCi4uLi5v
Li4uLm8ub29vb28uLi4uCi4uLi5vLi4uLm8uLi4uLi4uLi4uCi4uLi5vLi4uLi5vb29vb28uLi4u
Ci4uLi5vb28uLi4uLi4uLi5vLi4uCi4uLi4uLm9vby4uLi5vb28uLi4uCi4uLi4uLi4uLm8uLi5v
Li4uLi4uCi4uLi4uLi5vb29vb28uLi4uLi4uCi4uLi4uLi4uLi4uLi4uLi4uLi4uCkhFUkUKICBh
LnNwbGl0KCJcbiIpLm1hcCB7fGl8IGkuc3BsaXQoIiIpfQplbmQKCmRlZiBsZWdhbCh4LHkpCiAg
eCA8IDIwIGFuZCB5IDwgMjAgYW5kIHggPj0gMCBhbmQgeSA+PSAwIGFuZCAkYm1wW3ldW3hdICE9
ICJvIiBhbmQgJGJtcFt5XVt4XSAhPSAiKiIKZW5kCgpkZWYgZmlsbF9zdGVwKG1ldGgpCiAgeCx5
ID0gbWV0aCA9PSA6c3Rh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