Check if this zero has exactly one 1 as neighbour
if ( ( ( i > 0 && str [ i - 1 ] == '1' ) && ( i < N - 1 && str [ i + 1 ] != '1' ) ) || ( ( i > 0 && str [ i - 1 ] != '1' ) && ( i < N - 1 && str [ i + 1 ] == '1' ) ) ) {