Pocket Gems interview question

Strstr convert ternary expression to tree