P8603 [Lanqiao Cup 2013 National C] Print a Binary Tree Horizontally.

Background

A binary tree can be used for sorting.

Description

The idea is simple: when inserting a new node into a binary search tree, first compare it with the root. If it is smaller, pass it to the left subtree to continue processing; otherwise, pass it to the right subtree. When an empty subtree is reached, place the node at that position. For example, with the input order `10 8 5 7 12 4`, the binary tree should be built as shown in Figure $1$. This problem requires: given the numbers, build a binary search tree, and print the tree horizontally to standard output.

Input Format

The input is one line of $N$ integers separated by spaces. $N < 100$, and each number does not exceed $10000$. $N$ is not given in the input. There are no duplicate numbers in the input.

Output Format

Output the horizontal representation of the binary search tree. To make it easier for the judging program to compare the number of spaces, please replace spaces with periods.

Explanation/Hint

Sample Explanation 1: ![](https://cdn.luogu.com.cn/upload/image_hosting/4z42ybq4.png) Time limit: 1 second, 64 MB. Lanqiao Cup 2013, the 4th National Finals. Translated by ChatGPT 5