I believe that Richard's nested parenthesis of "a (b (c d))" can be morphed into all possible versions of "a b c d", "a (b c d)", and "a b (c d)" but not into all the possible permutations of 2 other variations found necessary by Madruga i.e "(a b c) d" and "(a b)(c d)". Interestingly, Richard identified 1 generalized type of parenthesis that covers about 80% cases for the 5 variants. Thus he gets most of the solutions.

A quick & dirty test by me seems to show Howard's first set of code works correctly.

[ 23. September 2002, 21:55: Message edited by: Jack Lothian ]
_________________________
Jack