#include<stdio.h>
#include<string.h>
int main()
{
char str[1000],ch;
gets(str);
int letter=0,digit=0,other=0; //分别是英文,数字,其他。
int i;
for(i=0;(ch=str[i])!='\0';i++)
{
if(ch>='A'&&ch<='z')
letter++;
else if(ch>='0'&&ch<='9')
digit++;
else
other++;
}
printf("letter:%d\ndigit:%d\nother:%d\n",letter,digit,other);
return 0;
}
#include<string.h>
int main()
{
char str[1000],ch;
gets(str);
int letter=0,digit=0,other=0; //分别是英文,数字,其他。
int i;
for(i=0;(ch=str[i])!='\0';i++)
{
if(ch>='A'&&ch<='z')
letter++;
else if(ch>='0'&&ch<='9')
digit++;
else
other++;
}
printf("letter:%d\ndigit:%d\nother:%d\n",letter,digit,other);
return 0;
}