Regexless and ñapa implementation of the algorithm

I guess I didn't answered the problem correctly... 
Maybe the complexity is too high...
Just learnt a little bit of ruby, I'm sure I'm not following neither the style guides, neither common ruby patterns
Cheers,