Duh - turns out I need the 'prev = head' line in the 'else' statement, otherwise the last sublist (the collection of 'e' chars) gets left out.