Skip to content

Commit c5db31c

Browse files
Update anagrams.py
1 parent 4b726be commit c5db31c

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

strings/anagrams.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ def signature(word: str) -> str:
1616
>>> signature("finaltest")
1717
'a1e1f1i1l1n1s1t2'
1818
"""
19-
freq = collections.Counter(word)
20-
return "".join(f"{ch}{freq[ch]}" for ch in sorted(freq))
19+
frequencies = collections.Counter(word)
20+
return "".join(f"{char}{frequencies[char]}" for char in sorted(frequencies))
2121

2222

2323
def anagram(my_word: str) -> list[str]:

0 commit comments

Comments
 (0)