Given a binary number A as input with d > 1 digits, output a binary number B with d digits according to the following rules for finding the nth digit of B:
The first digit of B is zero if the first and second digits of A are equal; otherwise, it is one.
If 1 < n < d, then if the (n-1)th, nth and (n+1)th digits of A are equal, then the nth digit of B is zero; otherwise, it is one.
The dth digit of B is zero if the (d-1)th and dth digits of A are equal; otherwise, it is one.
Rules
String/list input/output format is fine. Another allowed way of input/output is an integer followed by the number of preceding zeros (or following the number of preceding zeros).
Make your code as short as possible.
Test Cases
00 -> 00
01 -> 11
11 -> 00
010111100111 -> 111100111100
1000 -> 1100
11111111 -> 00000000
01010101 -> 11111111
1100 -> 0110
1100 -> 0110
(the first 2 digits of the output are always identical in all other test cases; ditto for the last 2 digits) \$\endgroup\$