Permalink
Browse files

Use set

  • Loading branch information...
danielfone committed Jan 23, 2014
1 parent f320a7d commit fef0cfcba371dc29d9f0fd1f7bc0e1c9e1161b38
Showing with 3 additions and 1 deletion.
  1. +1 −0 .gitignore
  2. +2 −1 level0
View
@@ -0,0 +1 @@
+test/*
View
3 level0
@@ -1,12 +1,13 @@
#!/usr/bin/env ruby
+require 'set'
# Our test cases will always use the same dictionary file (with SHA1
# 6b898d7c48630be05b72b3ae07c5be6617f90d8e). Running `test/harness`
# will automatically download this dictionary for you if you don't
# have it already.
path = ARGV.length > 0 ? ARGV[0] : '/usr/share/dict/words'
-entries = File.read(path).split("\n")
+entries = File.read(path).split("\n").to_set
contents = $stdin.read
output = contents.gsub(/[^ \n]+/) do |word|

0 comments on commit fef0cfc

Please sign in to comment.