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.
Your code iterates through the entire string before checking the length. And it needs to, because the content matters.
whats the point of checking for the length after iterating through the entire string? sure its a cleaner code but i think it misses the point of checking the validity of the input for an efficient code