#include <stdio.h>
#include <windows.h>
#include <conio.h>
#define inputLen 12 //輸入長度
int main() {
//輸入一個字符串,統計英文字母、空格、數字和其它字符的個數
char input[inputLen];
gets(input);//輸入內容
char cinput=0;
int cinputlen = 0;
int emptyNum = 0, enNum = 0, numNum = 0, otherNum = 0;
printf("%s\n", input);
while (cinputlen < inputLen) {
cinput = input[cinputlen];
if (cinput == ' ') {//空格
emptyNum++;
}
else if (((cinput >= 'a') && (cinput <= 'z')) || ((cinput >= 'A') && (cinput <= 'Z'))) { //字符
enNum++;
}
else if ((cinput >= '0') && (cinput <= '9')) {//數字
numNum++;
}
else {//其它字符
otherNum++;
}
cinputlen++;
}
printf("empty=%d,enNum=%d,numNum=%d,otherNum=%d\n", emptyNum, enNum, numNum, otherNum);
return 0;
}