1160: 零起点学算法67——统计字母数字等个数
Time Limit: 1 Sec Memory Limit: 64 MB 64bit IO Format: %lldSubmitted: 2697 Accepted: 1339
[Submit][Status][Web Board]
Description
输入一串字符,统计这串字符里的字母个数,数字个数,空格字数以及其他字符(最多不超过100个字符)
Input
多组测试数据,每行一组
Output
每组输出一行,分别是字母个数,数字个数,空格字数以及其他字符个数
Sample Input 
I am a student in class 1.
I think I can!
Sample Output
18 1 6 1
10 0 3 1
HINT
char str[100];//定义字符型数组
while(gets(str)!=NULL)//多组数据
{
//输入代码
for(i=0;str[i]!=' ';i++)//gets函数自动在str后面添加' '作为结束标志
{
//输入代码
}
//字符常量的表示,
'a'表示字符a;
'0'表示字符0;
//字符的赋值
str[i]='a';//表示将字符a赋值给str[i]
str[i]='0';//表示将字符0赋值给str[i]
}
Source
1 #include<stdio.h> 2 #include<string.h> 3 int main(){ 4 char ch[100]; 5 while(gets(ch)!=NULL){ 6 int a=0,b=0,c=0,d=0; 7 for(int i=0;ch[i]!='