View Code of Problem 58

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

int main() {
	char input[333];
	gets(input);
	int tag = 1;
	int sum = 0;
	
	for(int i = 0, length = strlen(input); i < length; i ++) {
		if(isalpha(input[i]) && tag == 1) {
			sum ++;
			tag = 0;
		} else if(input[i] == ' ') {
			tag = 1;
		}
		
	}
	printf("%d", sum);
	
	return 0;
}

Double click to view unformatted code.


Back to problem 58