Lexicographic Binary Tree

Constructs a cross reference index using a binary search tree, also known as a lexicographic tree, from a given text file. Click to view file

Input

civilization of science.
science is knowledge.
knowledge is our destiny.
#

Output

civilizati  1
destiny    3
is       2 3
knowledge   2 3
of      1
our    3
science  1 2