1*47854Sbostic /*- 2*47854Sbostic * Copyright (c) 1982 The Regents of the University of California. 3*47854Sbostic * All rights reserved. 4*47854Sbostic * 5*47854Sbostic * %sccs.include.proprietary.c% 621500Smckusick */ 721500Smckusick 89896Ssam #ifndef lint 921500Smckusick char copyright[] = 10*47854Sbostic "@(#) Copyright (c) 1982 The Regents of the University of California.\n\ 1121500Smckusick All rights reserved.\n"; 12*47854Sbostic #endif /* not lint */ 139896Ssam 1421500Smckusick #ifndef lint 15*47854Sbostic static char sccsid[] = "@(#)comp.c 5.2 (Berkeley) 04/08/91"; 16*47854Sbostic #endif /* not lint */ 1721500Smckusick 189896Ssam #include <stdio.h> 199896Ssam #define MAX ' ' 209896Ssam 219896Ssam char new[MAX], old[MAX]; 229896Ssam 239896Ssam main () 249896Ssam { 259896Ssam register int i, j; 269896Ssam old[0] = '\0'; 279896Ssam while (fgets(&new[0], MAX, stdin) != NULL) { 289896Ssam for (i=0; i<MAX && old[i]==new[i]; i++); 299896Ssam if (i >= MAX) { 309896Ssam fprintf(stderr, "long word\n"); 319896Ssam exit(1); 329896Ssam } 339896Ssam putc(i, stdout); 349896Ssam for (j=0; (old[j]=new[j]) != '\n'; j++); 359896Ssam old[j] = '\0'; 369896Ssam fputs(&old[i], stdout); 379896Ssam } 389896Ssam } 39