home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume17 / contest-prog / part01 / prob5.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-02-06  |  284 b   |  21 lines

  1. main()
  2. {
  3.     char line[256];
  4.     int i,j,wc;
  5.     char *gets();
  6.     
  7.     while( gets(line)==line)
  8.     {
  9.         if(strlen(line)==0){printf("0\n");continue;}
  10.         i=0;
  11.         wc=0;
  12.     for(i=0;line[i];i++){
  13.     if(line[i]>='a' && line[i]<='z'){
  14.                         if(line[i+1]<'a' ||line[i+1]>'z')wc++;
  15.             }
  16.     }
  17.     printf("%d\n",wc);
  18.     }
  19. }
  20.  
  21.