Anagrams: Difference between revisions
Content deleted Content added
Add Groovy |
|||
Line 158:
{ "evil" "levi" "live" "veil" "vile" }
}</pre>
== {{header|Groovy}} ==
This program:
<lang groovy>
def words = new URL('http://www.puzzlers.org/pub/wordlists/unixdict.txt').text.readLines()
def groups = words.groupBy{ it.toList().sort() }
def bigGroupSize = groups.collect{ it.value.size() }.max()
println groups.findAll{ it.value.size() == bigGroupSize }.collect{ it.value }.collect{ it.join(' ') }.join('\n')
</lang>
produces this output:
<pre>
abel able bale bela elba
alger glare lager large regal
angel angle galen glean lange
caret carte cater crate trace
elan lane lean lena neal
evil levi live veil vile
</pre>
== {{header|Haskell}} ==
|