Right View of Binary Tree. Help needed in debugging

My code is showing wrong output. Could you please tell where i am going wrong?

input is given as level order traversal. you must read input level wise not in preorder traversal.
correct code is here: https://ide.codingblocks.com/s/209780

thannks