UVA 494 Kindergarten Counting Game

#include <cstdio>
#include <cstring>

int main() {
	char str[300];
	while (gets(str)) {
		int count = 0;
		int len = strlen(str);
		for (int i = 0; i < len; i++) {
			if ((str[i] >= 'A' && str[i] <= 'Z' || str[i] >= 'a' &&str[i] <= 'z') 
				&& !(str[i+1] >= 'A' && str[i+1] <= 'Z' || str[i+1] >= 'a' &&str[i+1] <= 'z'))
				count++;
		}
		printf("%d\n", count);
	}
	return 0;
}

你可能感兴趣的:(UVA 494 Kindergarten Counting Game)