Created
April 14, 2018 09:53
-
-
Save ravelll/4d831a22d8c97873d3f6d191d1635bce to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def answer?(str) | |
filtered = str.split('').keep_if{|s| s.match(/[a-zA-Z0-9-]/)} | |
if filtered && filtered.count == filtered.uniq.count | |
return true | |
end | |
false | |
end | |
pp IO.readlines("./english_collocates.md", chomp: true).keep_if{|s| answer?(s)}.sort_by{|s| s.length} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment