Program ViewRoot;

{***************************************************************************}

Uses

  Croft,

  Crt;



const

  NumTotal = 100;

  SubTotal = 10;



var

  Root,

  ID: integer;

  InStr: string;

  StrArr: array[1..NumTotal] of string;

  NumChildren:  array[1..SubTotal] of integer;

  Children: array[1..SubTotal, 1..SubTotal] of integer;

  alpha,

  bravo: integer;



{***************************************************************************}

{***************************************************************************}

{***************************************************************************}

begin

  Root := 1;

  ID := 1;

  for alpha := 1 to SubTotal do

    NumChildren[alpha] := 0;

  for alpha := 1 to SubTotal do

    for bravo := 1 to SubTotal do

      Children[alpha,bravo] := 0;

  ;

  Clr;

  Ask('Root:  ', InStr);

  StrArr[Root] := InStr;

  repeat

    Ask('  Calls:  ',InStr);

    if InStr <> '' then

      begin

        Inc(ID);

        StrArr[ID] := InStr;

        Inc(NumChildren[Root]);

        Children[Root, NumChildren[Root]] := ID;

      end;

  until InStr = '';

  Clr;

  for alpha := 1 to ID do

    writeln(alpha,' = ',StrArr[alpha]);

  writeln(MultiChar('*',80));

  writeln('  1');

  alpha := 0;

  while alpha <= NumChildren[Root] do

    begin

      writeln(MultiChar(' ',Root*3), StrIntLen(Children[Root, alpha], 3));

      Inc(alpha);

    end;



  wait;

end.