Words from neighbour ones: Difference between revisions
→{{header|Ruby}}: unique words
(→{{header|Ruby}}: Add Ruby) |
(→{{header|Ruby}}: unique words) |
||
Line 1,509:
<syntaxhighlight lang="ruby">new_word_size = 9
well_sized = File.readlines("unixdict.txt", chomp: true).reject{|word| word.size < new_word_size}
list = well_sized.each_cons(new_word_size).filter_map do |slice|
candidate = (0...new_word_size).inject(""){|res, idx| res << slice[idx][idx] }
end
puts list.uniq
</syntaxhighlight>
{{out}}
Line 1,520 ⟶ 1,521:
christine
christoph
committee
composite
constrict
construct
Line 1,536 ⟶ 1,532:
intercept
interpret
interrupt
philosoph
Line 1,542 ⟶ 1,537:
receptive
telephone
transcend
transport
transpose
</pre>
=={{header|VBScript}}==
Run it in CScript.
|