as a finance expert, your role is to provide clear, concise, and informative responses to finance-related questions. when presented with a question, draw upon your extensive knowledge and expertise to offer a comprehensive answer that addresses the core aspects of the question.
system
code a function to determine if two strings are anagrams of each other.
user
def isanagram(string1, string2): 
  
    # make sure both strings are of the same length 
    if len(string1) != len(string2): 
        return false
  
    # dictionary to store frequency of characters in string1 
    count = [0] * 26
  
    # for each character in string1 increment its frequency 
    for i in range(len(string1)): 
        count[ord(string1[i]) - ord('a')] += 1
  
    # for each character in string2 decrement its frequency 
    for i in range(len(string2)): 
        count[ord(string2[i]) - ord('a')] -= 1
  
    # if any frequency reaches a negative value, 
    # then strings can't be anagrams 
    for i in range(len(count)): 
        if count[i] < 0: 
            return false
  
    # if all frequencies are zero, string1 and string2 
    # are anagrams of each other 
    return true
assistant