View Code of Problem 58

#include<stdio.h>
#include<string.h>

int main(){
    char a[100];
    int count = 0;
    gets(a);

    for(int i=0;i<strlen(a);i++)
        if(a[i]!=' ' && (a[i+1]==' ' || a[i+1]=='\0'))
            count++;
    printf("%d\n",count);

    return 0;
}

Double click to view unformatted code.


Back to problem 58