Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Does not work properly when a negative number is given
You could also do (0...number) instead of (1...number)
Interesting! I was not aware of the range syntax with 3 dots, where 1...n exludes the end of the range.
It should throw an error if no subs are performed
No need to handle double spaces.
The regular expression
(WUB)+
does not matchWUB
but as many as possible consecutivesWUB
(because of+
).For example, in the string
STARTWUBWUBWUBBEND
, a unique match is detected (WUBWUBWUB
) and replaced by a unique space.Hope this helps.
This comment is hidden because it contains spoiler information about the solution
I don't understand how this handles double spaces. Could someone explain, please?
O my love. So beautiful
short and pithy,easy to read