You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
561 B
28 lines
561 B
#include<stdio.h>
|
|
void tongji(char str[]);
|
|
int main()
|
|
{
|
|
char str[1000]={'\0'};
|
|
gets(str);
|
|
tongji(str);
|
|
return 0;
|
|
}
|
|
void tongji(char str[])
|
|
{
|
|
int xxzm=0,dxzm=0,sz=0,kg=0,qt=0;
|
|
for(int i=0;str[i]!='\0';i++)
|
|
{
|
|
if('a'<=str[i]&&str[i]<='z')
|
|
xxzm++;
|
|
else if('A'<=str[i]&&str[i]<='Z')
|
|
dxzm++;
|
|
else if('0'<=str[i]&&str[i]<='9')
|
|
sz++;
|
|
else if(str[i]==' ')
|
|
kg++;
|
|
else
|
|
qt++;
|
|
}
|
|
printf("%d %d %d %d %d \n",dxzm,xxzm,sz,kg,qt);
|
|
}
|