View Code of Problem 58

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

Double click to view unformatted code.


Back to problem 58