View Code of Problem 58

#include<stdio.h>
#include<string.h>
#include<ctype.h>
int main()
{
char s[100];
int i,j,n;
j=0;
gets(s);
n=strlen(s);
for(i=0;i<n;i++)
{
if(isalpha(s[i])&&s[i+1]==' ')
j++;

}
if(isalpha(s[n-1]))
j++;

printf("%d",j);


}

Double click to view unformatted code.


Back to problem 58