Advertisement
Guest User

Untitled

a guest
Nov 13th, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.47 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <ctype.h>
  4.  
  5. int main()
  6. {
  7.     FILE *fin = stdin;
  8.     char str[10000];
  9.     int counter = 0;
  10.  
  11.     fgets(str, 10000, fin);
  12.     if(strlen(str) != 0 && isalpha(str[0]))
  13.         counter++;
  14.  
  15.  
  16.     for(int i = 0; i < strlen(str); i++)
  17.     {
  18.         if(str[i] == ' ' && isalpha(str[i + 1]))
  19.         {
  20.             while(str[i] == ' ')
  21.                 i++;
  22.             counter++;
  23.         }
  24.     }
  25.  
  26.     printf("%d", counter);
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement