HTML & JS
#function defination and declaration
def areAnagram(string1, string2):
    
    #an array of zeros 
    len1 = len(string1)
    len2 = len(string2)
    sum = 0
    
    #Check if the lengths are same or not
    if len1 != len2:
        print("Not Anagram")
        return
        
    #ord(char) function provides the ASCII value of the argument
    for itr in range(len1):
        sum += ord(string1[itr])
        sum -= ord(string2[itr])
    
    if(sum != 0):
        print("Not Anagram")
        return

    print("Anagram")
    return

#driver code
str1 = "geekstocode"
str2 = "codegeeksto"
#function call
areAnagram(str1, str2)

Generated URL:

Output:

Anagram
Report Bug