编辑代码

#include <stdio.h>

/* 事例1111111*/
int main()
{
   /*  Write C code in this online editor and run it. */
	int letters = 0, digits = 0, spaces = 0, others = 0;
	char c;
   	printf("输入一串字符,按回车已\n");
	while((c = getchar()) != '\n') {
        //printf("1111%c\t",c);

		if((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) {
			letters++;
		} else if(c >= '0' && c<= '9') {
			digits++;
		} else if(c == ' ') {
			spaces++;
		} else {
			others++;
		}

	}
	
	printf("字母:%d,数字=%d,空格=%d,其他字符=%d\n",letters,digits,spaces,others);
   
   return 0;
}