Files
Arquivotheca.SunOS-4.1.4/games/boggle/comp.c
seta75D ff309bfe1c Init
2021-10-11 18:37:13 -03:00

28 lines
507 B
C

#ifndef lint
static char sccsid[] = "@(#)comp.c 1.1 94/10/31 SMI"; /* from UCB 4.1 12/24/82 */
#endif
#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);
/* NOTREACHED */
}