{ diff.txt -- Algorithm #8: Differential Compression by Tom Swan }

procedure Compress(var W, P: String);
var
  T: String;   { Temporary copy of W }
  I: Integer;  { String index }
begin
  Copy W to T;
  Set I equal to 1;
  while (I <= Length(W)) and 
        (I <= Length(P)) and 
        (W[I] = P[I]   ) do
    I <- I + 1;
  Delete I - 1 chars from head of W;
  Insert Chr(I - 1) at head of W;
  Set P equal to T;
end;


(*
// --------------------------------------------------------------
// Copyright (c) 1993 by Tom Swan. All rights reserved
// Revision 1.00    Date: 04/07/1993   Time: 08:37 am
*)
