View Code of Problem 58

#include <stdio.h>
#include <string.h>
int main(){
	char str[100];
	gets(str);
	int flag=0,count=0,i;
	for(i=0;i<strlen(str);i++){
		if(flag==0){
			if(str[i]>='a'&&str[i]<='z'){
				count++;
				flag=1;
			}else if(str[i]>='A'&&str[i]<='Z'){
				count++;
				flag=1;
			}
		}else{
			if(str[i]==' ')
				flag=0;
		}
	}
	printf("%d",count);
	return 0;
}

Double click to view unformatted code.


Back to problem 58