Pregunta de entrevista de Pocket Gems

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.