Veeva Systems interview question

Write a function to build tree from given string.