Ooops. I forgot that the abstraction barrier only provided a way to inspect the invlist, not to construct a new one. The interesting part is just to figure out how to compute for each symbol a the locations at which a appears in the reversal. I suggest that you just work that out on paper, and forget this one as a programming exercise.