Pocket Gems Interview Question

Write a function which, given a ternary expression string input, parses the input into the correct tree and returns the root node of the tree.