Note that there are some explanatory texts on larger screens.

plurals
  1. POCode golf: find all anagrams
    text
    copied!<p>A word is an <a href="http://en.wikipedia.org/wiki/Anagram" rel="noreferrer">anagram</a> if the letters in that word can be re-arranged to form a different word.</p> <h2>Task:</h2> <ul> <li>The shortest source code by character count to find all sets of anagrams given a word list.</li> <li>Spaces and new lines should be counted as characters</li> <li><p>Use the code ruler </p> <p>---------10--------20--------30--------40--------50--------60--------70--------80--------90--------100-------110-------120</p></li> </ul> <h2>Input:</h2> <p>a <a href="http://cmalabs.com/files/words" rel="noreferrer">list of words</a> from stdin with each word separated by a new line.</p> <p>e.g.</p> <pre><code>A A's AOL AOL's Aachen Aachen's Aaliyah Aaliyah's Aaron Aaron's Abbas Abbasid Abbasid's </code></pre> <h2>Output:</h2> <p>All sets of anagrams, with each set separated by a separate line.</p> <p>Example run:</p> <pre><code>./anagram &lt; words marcos caroms macros lump's plum's dewar's wader's postman tampons dent tend macho mocha stoker's stroke's hops posh shop chasity scythia ... </code></pre> <p>I have a 149 char perl solution which I'll post as soon as a few more people post :)</p> <p>Have fun!</p> <h2>EDIT: Clarifications</h2> <ul> <li>Assume anagrams are case insensitive (i.e. upper and lower case letters are equivalent)</li> <li>Only sets with more than 1 item should be printed</li> <li>Each set of anagrams should only be printed once</li> <li>Each word in an anagram set should only occur once</li> </ul> <h2>EDIT2: More Clarifications</h2> <ul> <li>If two words differ only in capitalization, they should be collapsed into the same word, and it's up to you to decide which capitalization scheme to use for the collapsed word</li> <li>sets of words only have to end in a new line, as long as each word is separated in some way, e.g. comma separated, or space separated is valid. I understand some languages have quick array printing methods built in so this should allow you to take advantage of that if it doesn't output space separated arrays.</li> </ul>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload