Problem 1910 · Medium

Remove All Occurrences of a Substring

Repeatedly erase the leftmost occurrence of a given substring until none is left, then return what remains. The visual shows the string with the matched block cut out and the pieces closing together.

Open the interactive visualisation