Veeva Systems Interview Question

Write a function to build tree from given string.