Write a method that prints a tree sideways. For example, the tree in figure 1 would be printed:

George
+--Edward VIII
+--George VI
|  +--Elizabeth II
|  |  +--Charles
|  |  |  +--William
|  |  |  +--Harry
|  |  +--Anne
|  |  |  +--Peter
|  |  |  |  +--Savannah
|  |  |  +--Zara
|  |  +--Andrew
|  |  |  +--Beatrice
|  |  +--Edward
|  |     +--Louise
|  |     +--Severn
|  +--Margreth
+--Mary
+--Henry
|  +--Richard
...

Pay attention to the | lines and note that they stop after the last node (e.g. look at the line of Louise).

Hint:Use a recursive helper

public void print(String prefix)
in the Node class, where prefix is the pattern of | that precedes a line, such as

"|  |     "

in front of Louise.

The TreeReader reads a tree in the format (data child1 child2 ... childn). For example:

     Fred
    /    \
Wilma   Barney

should be typed in from command line as: (Fred (Wilma) (Barney)) Be aware of the parentheses around each node, including the leaves.

Draft: Print a tree with a root and two leaves correctly.