#include <stdio.h>

main() {
  char c;
  int nwords = 0;
  int nlines = 0;
  int nchars = 0;
  int state = 0;  /* 0 = not in word, 1 = in word */

  while ((c = getchar()) != EOF) {
    nchars++;
    if (c == '\n')
      nlines++;
    if (c == ' ' || c == '\n')
      state = 0;
    else if (state == 0) {
      state = 1;
      nwords++;
    }
  }
  printf("%d lines, %d words, %d characters",
	 nlines, nwords, nchars);
}
