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.
I like the idea of using the first words length as an initializer. In mine I assigned a -1 to start and then had to have an if statement in an each loop to get the initial, this would remove about two lines from mine. Nice!
Similarly I'd recommend using each instead of a while loop.
Also I think I'd use words.count for the array size over length so as not to confuse a maintainer if I was using this in prod code.
Only thing I dislike about this, is the RubyDocs say sort is not guaranteed to be stable. It may work for the kata just fine though.