Function to return the ending index for the largest valid sub - str1ing starting from index i
def getEndingIndex ( str1 , n , i ) : NEW_LINE INDENT i += 1 NEW_LINE while ( i < n ) : NEW_LINE INDENT curr = str1 [ i ] NEW_LINE prev = str1 [ i - 1 ] NEW_LINE DEDENT DEDENT