Added another option for printing the sorted words