/*- * Copyright (c) 1982, 1993 * The Regents of the University of California. All rights reserved. * * This module is believed to contain source code proprietary to AT&T. * Use and redistribution is subject to the Berkeley Software License * Agreement and your Software Agreement with AT&T (Western Electric). */ #ifndef lint static char copyright[] = "@(#) Copyright (c) 1982, 1993\n\ The Regents of the University of California. All rights reserved.\n"; #endif /* not lint */ #ifndef lint static char sccsid[] = "@(#)comp.c 8.1 (Berkeley) 5/31/93"; #endif /* not lint */ #include <stdio.h> #define MAX ' ' char new[MAX], old[MAX]; main() { register int i, j; old[0] = '\0'; while (fgets(&new[0], MAX, stdin) != NULL) { for (i=0; i<MAX && old[i]==new[i]; i++); if (i >= MAX) { fprintf(stderr, "long word\n"); exit(1); } putc(i, stdout); for (j=0; (old[j]=new[j]) != '\n'; j++); old[j] = '\0'; fputs(&old[i], stdout); } exit(0); }