Glad that len(s) < 1000
len(s) < 1000
yes, clear, stupid me :-)
This comment is hidden because it contains spoiler information about the solution
Added 100 random test cases
I'm curious how do you define one-liner if a code that is literally one-line doesn't count as one to you.
Nicely escaping reduce!
tell me why doesn't it work with one less space between the groups and %4?
I don't understand the difference between len(word) > i + 1 and len(word) > i in this case would you mind explaining me please ? For me it does the exact same thing and i can't figure how it manage the shortest words :/
errrr.... it's actually a good question... x)
3 years later, I'd actually say it's perfectly fine in this situation (I guess I had in mind something about saturation of the memory with the extra list, but in most situations you won't see any problem. Now, if n is huge, you'll run into troubles anyway, but not necessarily because of the approach itself, but rather because of the size of the string you have to build...)
ccl: forget that message.
Could you elaborate on which specific aspect of the above code is dangerous or footgun-y?