How to take input in this format

I am not able to take input in this format, can you please suggest me a way on how to build the tree.

Hey @great you can take input like this

Hey encoder, Thanks a lot for your reply. I understand the intution behind your code but I am still not able to debug why my program is not working. Please see to it and let me know. (i am talking about building part only in the code attached, it is described by function buildBT.

Check now ->

Thanks, it is working now, but actually, this is my code, why you comment the else below

Just to make right recursive calls, we first make left and right node of a particular node, then build another nodes of tree. dry run you will get intuition.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.