Skip to main content
2 of 2
added 750 characters in body
Kevin Cruijssen
  • 136.3k
  • 14
  • 155
  • 394

05AB1E, 12 bytes

ΔDγ.Δg3@}õ.; 

Try it online or verify all test cases.

.Δ...} could alternatively be D...Ïн and/or g3@ could alternatively be 7b@ for equal-bytes alternatives:

Try it online or verify all test cases.

Explanation:

Δ # Loop until the result no longer changes (using the implicit input): D # Duplicate the current integer γ # Split the copy into parts of equal adjacent digits .Δ } # Pop and find the first that's truthy for (or -1 if none are): g # Push the length of the group 3@ # Check whether this length is >= 3 õ # Push an empty string "" .; # Replace the first occurrence of the found 3+ digits group with this "" # (after the loop, the result is output implicitly) D # Duplicate the list of parts of equal adjacent digits 7b # Push 7, and convert it to a binary-string: "111" @ # Check for each value in the copy whether it's >= 111 Ï # Only keep the parts for which this is truthy н # Pop and keep the first element (or "" if none were) 
Kevin Cruijssen
  • 136.3k
  • 14
  • 155
  • 394