Find words whose first and last three letters are equal: Difference between revisions

Content added Content deleted
(add sed)
(→‎{{header|Ruby}}: removed chomped temp array)
Line 844: Line 844:


=={{header|Ruby}}==
=={{header|Ruby}}==
<syntaxhighlight lang="ruby">words = File.readlines("unixdict.txt").map(&:chomp)
<syntaxhighlight lang="ruby">puts File.readlines("unixdict.txt", chomp: true).select{|w| w.end_with?(w[0,3]) && w.size > 5}
puts words.select{|w| w.end_with?(w[0,3]) && w.size > 5}
</syntaxhighlight>
</syntaxhighlight>
{{out}}
{{out}}