#include<bits/stdc++.h>
using namespace std;
class node{
public:
string data;
nodeleft;
noderight;
node(string d)
{
data=d;
left=NULL;
right=NULL;
}
};
nodebuildTree(){
string d;
cin>>d;
if(d==“true”){
node root = new node(d);
root->left = buildTree();
root->right = buildTree();
return root;
}
return NULL;
}
bool isSameTree(node* root1, node* root2)
{
// if(root1==NULL && root2==NULL){// when both tree are null then they are identical
// return true;
// }
if(root1==NULL || root2==NULL){// when one of tree is null then they are not identical
return true;
}
return( isSameTree(root1->left, root2->left) && isSameTree(root1->right,root2->right) ) ;// recc call
}
int main() {
node* root1 = buildTree();
node* root2 = buildTree();
if(isSameTree(root1,root2)){
cout<<“true”;
}
else cout<<“false”;
return 0;
}