A Utility Function to find the common prefix between strings - str1 and str2
def commonPrefixUtil ( str1 , str2 ) : NEW_LINE INDENT result = " " NEW_LINE n1 , n2 = len ( str1 ) , len ( str2 ) NEW_LINE i , j = 0 , 0 NEW_LINE while i <= n1 - 1 and j <= n2 - 1 : NEW_LINE INDENT if str1 [ i ] != str2 [ j ] : NEW_LINE INDENT break NEW_LINE DEDENT result += str1 [ i ] NEW_LINE i , j = i + 1 , j + 1 NEW_LINE DEDENT return result NEW_LINE DEDENT