View Code of Problem 58

#include <stdio.h>
#include<math.h>
 int main()
 {
    char s[10000];
    gets(s);
    int count=0;
    for(int i=0;i<strlen(s)-1;i++){
        if(s[i]==' '&&s[i+1]!=' ')count++;
    }
    if(s[0]==' ')printf("%d",count);
        else
        printf("%d",count+1);
    return 0;
 }

Double click to view unformatted code.


Back to problem 58