字符统计
总提交: 1349
490
描述
给出一串字符,要求统计出里面的字母、数字、空格以及其他字符的个数。
字母:A, B, …, Z、a, b, …, z组成
数字:0, 1, …, 9
空格:”
剩下的可打印字符全为其他字符。
输入
测试数据有多组。
每组数据为一行(长度不超过100000)。
数据至文件结束(EOF)为止。
输出
每组输入对应一行输出。
包括四个整数a b c d,分别代表字母、数字、空格和其他字符的个数。
样例输入
1 |
<font style="Line-HeiGHT: 24px; WorD-WrAp: normal; WorD-BreAK: normal" size="3" face="Times New Roman">A0 ,</font> |
样例输出
1 |
<font style="Line-HeiGHT: 24px; WorD-WrAp: normal; WorD-BreAK: normal" size="3" face="Times New Roman">1 1 1 1</font> |
#include
#include
using namespace std;
void ma(char str[100000])
{
long int a=0,b=0,c=0,d=0,i;
if(str[i]>=’0’&&str[i]<=’9′)
if(str[i]==’ ‘)
‘<<c<<‘ ‘<<d<<‘ ‘;
}
int main()
{
}
This article is automatically posted by WP-AutoPost : WordPress自动采集发布插件
文章来源设置,WP-AutoPost