Doubt - structurally identical tree

i am getting wrong ans for one test and cant figure out why ,Plz help …
code:

/// program to check if program is structurally same or not

#include
#inlcude
using namespace std;

class node
{
public:
int data;
node* left;
node* right;
node(int d)
{
data=d;
left=NULL;
right=NULL;
}
};

void BuildTree(node*& root){
int data;
cin >> data;
root = new node(data);

string temp;
cin>>temp;
if(temp=="true"){
    BuildTree(root->left);
}
cin>>temp;
if(temp=="true"){
    BuildTree(root->right);
}

}

bool SameorNot(node* root1,node* root2 )
{
if(root1==NULL&&root2==NULL)
{
return true;
}
if(root1==NULL||root2==NULL)
{
return false;
}
bool a,b,c;
a=(root1->data==root2->data);
b=SameorNot(root1->left,root2->left);
c=SameorNot(root2->right,root2->right);
return (a&&(b&&c));
}

int main()
{
node* root1=NULL;
node* root2=NULL;
BuildTree(root1);
BuildTree(root2);
if(SameorNot(root1,root2))
{
cout<<“true”<<endl;
}
else
{
cout<<“false”<<endl;
}
return 0;
}

que link: https://hack.codingblocks.com/contests/c/443/474

Heyy ! i think you have written something wrong in BuildTree function . Suppose the current input is false then you should return NULL but you are not doing that .
You can take help of this https://ide.codingblocks.com/#/s/14735