Added a method to check if strings are anagrams