<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">import java.io.*;
import java.util.*;

/** Exercising some BST methods. */

public class Driver {

  public static void main(String[] args) throws IOException {

    // Here's a BST for you to work with.
    BST tree = new BST();

    // As an end-of-term gift, we've already written the code to read
    // integers from the keyboard and insert them into a BST, stopping
    // when the user types "STOP".

    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    while (true) {
      System.out.print("? ");
      System.out.flush();
      String line = in.readLine();
      if (line.equals("STOP")) {
        break;
      }
      // Put the number into the tree.
      tree.insert(Integer.parseInt(line));
    }

    System.out.println("----");

    // Print the tree.
    tree.print();

  } // main(String[])

} // Driver
</pre></body></html>