147854Sbostic /*- 2*60755Sbostic * Copyright (c) 1982, 1993 3*60755Sbostic * The Regents of the University of California. All rights reserved. 447854Sbostic * 547854Sbostic * %sccs.include.proprietary.c% 621500Smckusick */ 721500Smckusick 89896Ssam #ifndef lint 9*60755Sbostic static char copyright[] = 10*60755Sbostic "@(#) Copyright (c) 1982, 1993\n\ 11*60755Sbostic The Regents of the University of California. All rights reserved.\n"; 1247854Sbostic #endif /* not lint */ 139896Ssam 1421500Smckusick #ifndef lint 15*60755Sbostic static char sccsid[] = "@(#)comp.c 8.1 (Berkeley) 05/31/93"; 1647854Sbostic #endif /* not lint */ 1721500Smckusick 189896Ssam #include <stdio.h> 199896Ssam #define MAX ' ' 209896Ssam 219896Ssam char new[MAX], old[MAX]; 229896Ssam main()2357818Storekmain() 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 } 3857818Storek exit(0); 399896Ssam } 40