Jelly, 14 bytes
Œɠ>2i1œPŒgFµÐL
Takes input as a list of digits, outputs as a list. Outputs []
if the result is empty. The TIO footer converts to/from numbers to lists (and converts []
to 0
)
How it works
Œɠ>2i1œPŒgFµÐL - Main link. Takes a list of digits D on the left
µÐL - Until a fixed point is reached, do the following:
Œɠ - Run lengths of equal adjacent elements
>2 - Greater than 2?
i1 - Find the first truthy index, i
Œg - Group equal adjacent elements
œP - Split, removing the element at the index i
F - Flatten