My fault guys sorry!!! I switched back to rich formating by inadvertence. That was a known issue with gmail IIRC. Here it goes again: This was a nice quiz, maybe not too challenging, but as Tom put it correctly the different codes can easily get mangled up. I have found a solution that seems to handle the few testcases well, we will see if it pleases ;). My additional challenge was to make my solution work with HighLine, Facets and Term::Ansicolor, and that is what I did :). The solution can be found here too: http://pastie.org/333319 And to test all libraries simply type > for i in term/ansicolor facets/ansicode highline; do ruby1.9 rd-185-sol.rb -f $i; done > ruby1.9 rd-185-sol.rb runs, transparently, with a random library of all registered HYLI