Sorting an array of words, input by user, into order. Improved from example by Mark Tranter of CAS Online.