Example list below. All elements are in the form {1 or 0, 1 or 0, 1 or 0}, with a least one of the numbers 0 and 1 in the element (so excluding {1,1,1} and {0,0,0})
ListA = {{1, 1, 0}, {1, 1, 0}, {1, 1, 0}, **{0, 1, 1}**, {1, 0, 1}, {1, 0, 1}, {1,
0, 1}}
I want a command to replace any single lone entry in the sequence to be replaced with the next sequence.
In List A the single lone entry is {0, 1, 1} as before this there are three {1, 1, 0} in a succession and following the single lone entry there are three {1, 0, 1} in a succession. So I want this lone entry to be replaced by {1, 0, 1}.
I want the command to be generic so can handle any combination of lone entries, I believe there will be 6 different scenarios (assuming the element sequence either side of the lone entry are different). Another example of lone entry of {{1, 1, 0}, {1, 1, 0}, {1, 0, 1}, {0, 1, 1}, {0, 1, 1}}
Lone entries at the start and end of the lists can be ignored.