Find occurrence of i + 'a
' NEW_LINE INDENT occurrence = dp [ i ] [ right ] - NEW_LINE INDENT dp [ i ] [ left ] + NEW_LINE ( str [ left ] == chr ( i + ord ( ' a ' ) ) ) NEW_LINE DEDENT if ( occurrence & 1 ) : NEW_LINE INDENT unMatchedCount += 1 NEW_LINE DEDENT DEDENT