The following is a pseudo code for step 1.
if no separator or vertical bar in the input, then all elements in word-list belong to sub-list 0. step 1 finishes. pointer points to sub-list 0. for each element is in word-list: if the element is a seperator: store the next element(s) to the pointed sub-list. move the pointer to the next sub-list. if the element is a vertical bar: move the pointer to the next sub-list. store all elements until the next vertical bar in the pointed sub-list. if the word after the next vertical bar is not a seperator move the pointer to the next sub-list. if the element is anything else: store the element in the pointed sub-list.