Exercise: Sort based on secondary condition
We have a file with strings in it. We would like to sort then according to length. The short strings first. The result is that within the strings of the same length we see them in random order. How can we sort them according to abc? So first come the short strings, but within each length we have abc order.
examples/data/words_to_sort.txt
Foo Foobar Bar Baz Moo Another Reallylong Shorter
Solutions
Published on 2015-10-28