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.
nice!
nice hack using length of source as maxlength
Also,
strings.Split(s, " ") is equvalent to string.Fields(s)
I'd say the proper way is:
Seen this on Go blog.
Cheers :)
This solutions doesn't account for unicode characters!
E.g.
len("→")
=> 2Use
len([]rune("→")
=> 1I got this output (and failed the final tests) in exactly the same way because I was trying to use
string()
to cast arune
. In order to pass the randomized test, the code needs to be able to account forrune
s greater than a single byte.I actually only had to make minimal changes to my code to pass the tests otherwise, so I'm leaving this for anyone else who may be tripped up by this - hopefully not spoiling too much :)