Check if Two Trees Are Identical
Determine whether two binary trees are structurally identical with the same node values.
Input format
The first line contains level-order tokens for tree 1. The second line contains tokens for tree 2.
Output format
Print true if the trees are identical, false otherwise.
Constraints
- Values fit in a 64-bit signed integer
- Trailing whitespace and a trailing newline are ignored by the judge
Read from stdin, write to stdout. Sample cases below show the exact format.
Sample cases
Example 1
Input
80 30
80 30Expected output
trueExample 2
Input
60 82 83 56 89 N 70 33 41 N 88 N N 55 35
60 82 83 56 89 N 70 33 41 N 88 N N 55 35Expected output
true