From: Jean-Julien Fleck Date: 2010-03-26T05:50:33+09:00 Subject: Re: All contiguous subsets Hello, > Isn't there a cleaner way? Perhaps you could use each_cons (from 1.8.7): str = "1 2 3 4" arr = str.split arr.size.downto(1) do |i| arr.each_cons(i) {|a| puts a.join(' ')} end Cheers, -- JJ Fleck PCSI1 Lycée Kléber