If same == true then it means a substring was found starting at position therefore all characters from position to length of substring found need to be changed therefore they needs to be marked
if ( same == True ) : NEW_LINE INDENT for i in range ( position , position + k ) : NEW_LINE INDENT pre [ i ] = True NEW_LINE DEDENT return NEW_LINE DEDENT