View Code of Problem 58

#include<bits/stdc++.h>
using namespace std;
int main(){
	char c[1000];
	gets(c);
	int len = strlen(c),num = 0;
	for(int i = 0;i <= len;i++){
		if((c[i] == ' ' ||c[i]=='\0') && isalpha(c[i-1])) num++;
	}
	cout<<num;	
	return 0;
} 

Double click to view unformatted code.


Back to problem 58