Recursive + iterative solution
each level processes entire string passed into it
- if first elements are equal - remove and add as child of current level
- if first elements not equal - remove first element pre order as parent and recursively call on substring of that to position where post order element was found
call with empty sentinal as parent of A
This will give you a result in MOST cases.