program c18clutst;

%include lb:[22,320]general3.typ;
%include de:[107,114]clunk.typ;
%include de:[107,114]c18clu.ext;
%include de:[107,114]cluc18.ext;

var
  in_string	: ch18;
  in_digit	: ch18;
  i		: integer;
  last_digit	: integer;
  offset	: integer;
  new_clunk	: clunk_type;

begin
  write('Enter digit string:');
  readln(in_string);
  
  for i := 18 downto 1 do
    if (last_digit = 0) and (in_string[i] <= '9') and (in_string[i] >= '0') 
    then
      last_digit := i;

  offset := 18 - last_digit;

  in_digit := '000000000000000000';

  for i :=  last_digit downto 1 do
    in_digit[i+offset] := in_string[i];

  new_clunk[1] := 0;
  new_clunk[2] := 0;
  new_clunk[3] := 0;
  new_clunk[4] := 0;

  c18clu(in_digit,new_clunk);

  writeln(in_string);
  writeln(in_digit);
  writeln(new_clunk[1],new_clunk[2],new_clunk[3],new_clunk[4]);

  in_digit := '000000000000000000';

  cluc18(new_clunk,in_digit);

  writeln(in_digit);
  writeln(new_clunk[1],new_clunk[2],new_clunk[3],new_clunk[4]);
end.
