1*21500Smckusick /* 2*21500Smckusick * Copyright (c) 1980 Regents of the University of California. 3*21500Smckusick * All rights reserved. The Berkeley software License Agreement 4*21500Smckusick * specifies the terms and conditions for redistribution. 5*21500Smckusick */ 6*21500Smckusick 79896Ssam #ifndef lint 8*21500Smckusick char copyright[] = 9*21500Smckusick "@(#) Copyright (c) 1980 Regents of the University of California.\n\ 10*21500Smckusick All rights reserved.\n"; 11*21500Smckusick #endif not lint 129896Ssam 13*21500Smckusick #ifndef lint 14*21500Smckusick static char sccsid[] = "@(#)comp.c 5.1 (Berkeley) 05/30/85"; 15*21500Smckusick #endif not lint 16*21500Smckusick 179896Ssam #include <stdio.h> 189896Ssam #define MAX ' ' 199896Ssam 209896Ssam char new[MAX], old[MAX]; 219896Ssam 229896Ssam main () 239896Ssam { 249896Ssam register int i, j; 259896Ssam old[0] = '\0'; 269896Ssam while (fgets(&new[0], MAX, stdin) != NULL) { 279896Ssam for (i=0; i<MAX && old[i]==new[i]; i++); 289896Ssam if (i >= MAX) { 299896Ssam fprintf(stderr, "long word\n"); 309896Ssam exit(1); 319896Ssam } 329896Ssam putc(i, stdout); 339896Ssam for (j=0; (old[j]=new[j]) != '\n'; j++); 349896Ssam old[j] = '\0'; 359896Ssam fputs(&old[i], stdout); 369896Ssam } 379896Ssam } 38