Ad
  • Default User Avatar

    No need to handle double spaces.

    The regular expression (WUB)+ does not match WUB but as many as possible consecutives WUB (because of +).

    For example, in the string STARTWUBWUBWUBBEND, a unique match is detected (WUBWUBWUB) and replaced by a unique space.

    Hope this helps.

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution