Pit Capitain schrieb:
> I get 541, too. Your code seems to not pay attention to the following 
> restriction:
> ...

Looking at your code I see that the restriction *IS* handled there. The 
check has to be repeated one more time, though, so it should be

   ((q=b[-1]).size-1).times

Then you get the same 541 results.

Regards,
Pit