this algorithm is to check if two strings are anagrams or not