title: Finding and grouping anagrams by Python
body: <pre><code>input: ['abc', 'cab', 'cafe', 'face', 'goo']
  output: [['abc', 'cab'], ['cafe', 'face'], ['goo']]
  </code></pre>
  
  <p>The problem is simple: it groups by <em>anagrams</em>. The order doesn't matter.</p>
  
  <p>Of course, I can do this by C++ (that's my mother tongue). But, I'm wondering this can be done in <strong>a single line</strong> by <strong>Python</strong>. <strong>EDITED: If it's not possible, maybe 2 or 3 lines.</strong> I'm a newbie in Python.</p>
  
  <p>To check whether two strings are anagram, I used sorting.</p>
  
  <pre><code>&gt;&gt;&gt; input = ['abc', 'cab', 'cafe', 'face', 'goo']
  &gt;&gt;&gt; input2 = [''.join(sorted(x)) for x in input]
  &gt;&gt;&gt; input2
  ['abc', 'abc', 'acef', 'acef', 'goo']
  </code></pre>
  
  <p>I think it may be doable by combining <code>map</code> or so. But, I need to use a <code>dict</code> as a hash table. I don't know yet whether this is doable in a single line. Any hints would be appreicated!</p>