diff --git a/1.rb b/1.rb index d17f942..4194688 100755 --- a/1.rb +++ b/1.rb @@ -9,6 +9,7 @@ def phrases(number) words = split all_strings = words (2..words.size).each do |number_of_words| + break if all_strings.length >= number all_strings += extract_phrases(words, number_of_words) end all_strings[0, number].map {|s| "'#{s}'"}.join(', ')