Jump to content

Anagrams: Difference between revisions

31 bytes added ,  15 years ago
(Add Groovy)
Line 166:
def groups = words.groupBy{ it.toList().sort() }
def bigGroupSize = groups.collect{ it.value.size() }.max()
printlndef bigAnagrams = groups.findAll{ it.value.size() == bigGroupSize }.collect{ it.value }.collect{ it.join(' ') }.join('\n')
println groups.findAll(bigAnagrams).collect{ it.value }.collect{ it.join(' ') }.join('\n')</lang>
</lang>
produces this output:
<pre>
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.