#include <stdio.h>
int main()
{
int n, i,letter, m, o, p;/*letter为英文字母 m为空格或回车 o为数字字符 p为其他字符*/
char ch;
letter = m = n = o = p = 0;
printf("Enter n :");
scanf_s("%d , &n");
getchar();
printf("Enter %d characters", n);
for (i = 1; i <= n; i++) {
ch = getchar();
if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')) {
letter++;
}
else if (ch == ' ' || ch == '\n') {
m++;
}
else if (ch >= '0' && ch <= '9') {
o++;
}
else {
p++;
}printf("letter=%d,m=%d,o=%d,p=%d", letter, m, o, p);
return 0;
}
}