1 /* 2 * Copyright (c) 1980 Regents of the University of California. 3 * All rights reserved. The Berkeley software License Agreement 4 * specifies the terms and conditions for redistribution. 5 */ 6 7 #ifndef lint 8 char copyright[] = 9 "@(#) Copyright (c) 1980 Regents of the University of California.\n\ 10 All rights reserved.\n"; 11 #endif not lint 12 13 #ifndef lint 14 static char sccsid[] = "@(#)comp.c 5.1 (Berkeley) 05/30/85"; 15 #endif not lint 16 17 #include <stdio.h> 18 #define MAX ' ' 19 20 char new[MAX], old[MAX]; 21 22 main () 23 { 24 register int i, j; 25 old[0] = '\0'; 26 while (fgets(&new[0], MAX, stdin) != NULL) { 27 for (i=0; i<MAX && old[i]==new[i]; i++); 28 if (i >= MAX) { 29 fprintf(stderr, "long word\n"); 30 exit(1); 31 } 32 putc(i, stdout); 33 for (j=0; (old[j]=new[j]) != '\n'; j++); 34 old[j] = '\0'; 35 fputs(&old[i], stdout); 36 } 37 } 38