If the current character is different from the previous then include this character and update previous character
if ( prev != s [ i ] ) : NEW_LINE INDENT prev = s [ i ] ; NEW_LINE answer += 1 ; NEW_LINE DEDENT return answer ; NEW_LINE