Skip to main content
add explanation
Source Link
c--
  • 2.5k
  • 1
  • 5
  • 15

sed -E, 18 bytes

Port of Arnauld's JavaScript answer.

:l
s/(.)\1\1+//
tl

Try it online!

Explanation

$ info '(sed)Programming Commands'
:l           # Specify the location of label 'l' for branch commands
s/(.)\1\1+// # Erase the first instance of 3 or more consecutive equal characters
tl           # Branch to label only if there has been a succesful 's'ubstitution

sed -E, 18 bytes

Port of Arnauld's JavaScript answer.

:l
s/(.)\1\1+//
tl

Try it online!

sed -E, 18 bytes

Port of Arnauld's JavaScript answer.

:l
s/(.)\1\1+//
tl

Try it online!

Explanation

$ info '(sed)Programming Commands'
:l           # Specify the location of label 'l' for branch commands
s/(.)\1\1+// # Erase the first instance of 3 or more consecutive equal characters
tl           # Branch to label only if there has been a succesful 's'ubstitution
Source Link
c--
  • 2.5k
  • 1
  • 5
  • 15

sed -E, 18 bytes

Port of Arnauld's JavaScript answer.

:l
s/(.)\1\1+//
tl

Try it online!