玉子狗尾草
var $char_num=0; var $kongge_num=0; var $int_num=0; var $other_num=0; while((ch=getchar())!='\n')//回车键结束输入,并且回车符不计入 { if(ch>='a'&&ch<='z'||ch<='z'&&ch>='a') { $char_num++; } else if(ch==' ') { $kongge_num++; } else if(ch>='0'&&ch<='9') { $int_num++; } else { $other_num++; } }echo $char_num; echo $kongge_num; echo $int_num; echo $other_num;望采纳,打字不容易啊