Instead of using sort, I used count sort since there are only 26 lower case letters. Therefore the time complexity is O(m) in ordering a string with average length of m. Then gives the hash value of the string with run-length code which costs O(log(m)) space for a single string.

Any idea to further improve the code since this costs 1080ms where my c++ version only costs 264ms.

```
class Solution:
# @param strs, a list of strings
# @return a list of strings
def contSort(self,instr):
cont=[0 for i in range(26)];
for i in range(len(instr)):
cont[ord(instr[i])-ord('a')]=cont[ord(instr[i])-ord('a')]+1;
hashval="";
for i in range(26):
hashval+=chr(ord('a')+i)+str(cont[i]);
return hashval
def anagrams(self, strs):
res=[];
if len(strs)<1:
return res;
mydict={};
for i in strs:
hashval=self.contSort(i);
if hashval in mydict:
mydict[hashval].append(i);
else:
mydict[hashval]=[i];
for i in mydict:
if len(mydict[i])>1:
for j in mydict[i]:
res.append(j)
return res;
```