/*
 * This code is from "Algorithms in C, Third Edition,"
 * by Robert Sedgewick, Addison Wesley Longman, 1998.
 * (This is an example of bad use of a library function.) 
 */
#include <stdio.h>
#include <string.h>
#define N 100000
main(int argc, char *argv[])
  { int i, j, t; 
    char a[N], *p = argv[1];
    for (i = 0; i < N-1; a[i] = t, i++)
      if ((t = getchar()) == EOF) break;
    a[i] = 0;
    for (i=0; i<strlen(a); i++)
     if (strncmp(&a[i],p,strlen(p))==0)
       printf("%d ", i);
    printf("\n");
  }
