Increment K if consecutive same elements are found
if ( s . charAt ( i ) == s . charAt ( i - 1 ) && s . charAt ( i ) == '0' ) k ++ ; else if ( s . charAt ( i ) == s . charAt ( i - 1 ) && s . charAt ( i ) == '1' ) l ++ ; }