String is anagram
Checks if a string is an anagram of another string (case-insensitive, ignores spaces, punctuation and special characters).
- Use
str.isalnum()
to filter out non-alphanumeric characters,str.lower()
to transform each character to lowercase. - Use
collections.Counter
to count the resulting characters for each string and compare the results.