擅长:python、mysql、java
<p>这可以通过使用字典来存储字符来简化。在</p>
<pre><code>def anagramlength(str1,str2):
dict = {}
for char in str1:
if char not in dict:
dict[char] = 0
dict[char] += 1
for char in str2:
if char not in dict:
dict[char] = 0
dict[char] -= 1
return sum(abs(n) for n in dict.values())
</code></pre>