#include<stdio.h>
int
main()
{
int
sz[10]={0},zm[26]={0},z[26]={0},i,space=0,e=0,t=0;
char
c;
printf
(
"请输入一段字符,统计其中各字符的数量
"
);
while
((c=
getchar
())!=
'
'
)
{
if
(c<=
'z'
&&c>=
'a'
)
zm[c-
'a'
]++;
else
if
(c<=
'Z'
&&c>=
'A'
)
z[c-
'A'
]++;
else
if
(c<=
'9'
&&c>=
'0'
)
sz[c-
'0'
]++;
else
if
(c==
' '
)
space++;
else
e++;
}
printf
(
"
"
);
for
(i=0;i<=9;i++)
{
t++;
printf
(
" %d的个数为%d "
,i,sz[i]);
if
(t%3==0)
printf
(
"
"
);
}
t=0;
printf
(
"
"
);
for
(i=0;i<=25;i++)
{
t++;
printf
(
" %c的个数为%d "
,i+97,zm[i]);
if
(t%3==0)
printf
(
"
"
);
}
t=0;
printf
(
"
"
);
for
(i=0;i<=25;i++)
{
t++;
printf
(
" %c的个数为%d "
,i+65,z[i]);
if
(t%3==0)
printf
(
"
"
);
}
t=0;
printf
(
"
"
);
printf
(
" 空格的个数为%d
"
,space);
printf
(
" 其他字符的个数为%d
"
,e);
return
0;
}