Words from neighbour ones: Difference between revisions
Content added Content deleted
(→{{header|Vlang}}: Rename "Vlang" in "V (Vlang)") |
(→{{header|Ruby}}: Add Ruby) |
||
Line 1,506: | Line 1,506: | ||
</pre> |
</pre> |
||
=={{header|Ruby}}== |
|||
<syntaxhighlight lang="ruby">new_word_size = 9 |
|||
well_sized = File.readlines("unixdict.txt", chomp: true).reject{|word| word.size < new_word_size} |
|||
well_sized.each_cons(new_word_size) do |slice| |
|||
candidate = (0...new_word_size).inject(""){|res, idx| res << slice[idx][idx] } |
|||
puts candidate if well_sized.include?(candidate) |
|||
end |
|||
</syntaxhighlight> |
|||
{{out}} |
|||
<pre>applicate |
|||
architect |
|||
astronomy |
|||
christine |
|||
christoph |
|||
committee |
|||
committee |
|||
committee |
|||
committee |
|||
committee |
|||
composite |
|||
constrict |
|||
constrict |
|||
construct |
|||
different |
|||
extensive |
|||
greenwood |
|||
implement |
|||
improvise |
|||
intercept |
|||
interpret |
|||
interrupt |
|||
interrupt |
|||
philosoph |
|||
prescript |
|||
receptive |
|||
telephone |
|||
transcend |
|||
transcend |
|||
transport |
|||
transpose |
|||
</pre> |
|||
=={{header|VBScript}}== |
=={{header|VBScript}}== |
||
Run it in CScript. |
Run it in CScript. |