If one of them is changed in the previous loop then subtract 1 from K ( 1 more is subtracted already ) and make them 9
elif ( k >= 1 and ( palin [ l ] != strr [ l ] or palin [ r ] != strr [ r ] ) ) : NEW_LINE INDENT k -= 1 NEW_LINE palin [ l ] = palin [ r ] = '9' NEW_LINE DEDENT l += 1 NEW_LINE r -= 1 NEW_LINE return palin NEW_LINE