Jump to content

Words from neighbour ones: Difference between revisions

→‎{{header|Ruby}}: unique words
(→‎{{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] }
puts candidate if well_sized.include?(candidate)
end
puts list.uniq
</syntaxhighlight>
{{out}}
Line 1,520 ⟶ 1,521:
christine
christoph
committee
committee
committee
committee
committee
composite
constrict
constrict
construct
Line 1,536 ⟶ 1,532:
intercept
interpret
interrupt
interrupt
philosoph
Line 1,542 ⟶ 1,537:
receptive
telephone
transcend
transcend
transport
transpose
</pre>
 
=={{header|VBScript}}==
Run it in CScript.
1,149

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.