I just have to say, this is quite a complicated little task you've set 
yourself.  I spent a couple of hours getting something[1] to even 
vaguely do what you want, and it's neither very clever (detecting 
redundancy) nor very optimal.  It also doesn't do the extra stuff, like 
detecting dupes or keeping tallies.

Oh and the section from lines 84-106 is an indulgence on my part, but it 
really helps understand what's going on.

[1] 
https://github.com/phluid61/ruby-experiments/blob/master/substring_puzzle/substrings.rb

-- 
Posted via http://www.ruby-forum.com/.