def editSim(str1, str2):
    """
    Calculates the EditSim(ES).

    Description: The EditSim between two strings str1 and str2, 
    is an edit distance based similarity measure calculated by
    1.0 - (ED(str1, str2)/maximum(length(str1), length(str2))).
    
    Parameters:
    str1(str): The first string
    str2(str): The second string

    Returns:
    float: the ES value
    """
    m = len(str1)
    n = len(str2)    
    dp = [[0 for x in range(n+1)] for x in range(2)]
    b = 0 
    for i in range(m+1):
        b = b^1
        for j in range(n+1):           
            if i == 0:
                dp[b][j] = j    
            elif j == 0:
                dp[b][j] = i    
            elif str1[i-1] == str2[j-1]:
                dp[b][j] = dp[b^1][j-1]            
            else:
                dp[b][j] = 1 + min(dp[b][j-1],        # Insert
                                   dp[b^1][j],        # Remove
                                   dp[b^1][j-1])    # Replace
 
    return 1.0 - (dp[b][n] / float(max(n,m)))