#include <stdio.h>
#include <string.h>
int letter,number,blank,other;
void count(char str[])
{
int i;
for(i=0;str[i]!='\0';i++)
{
if(str[i]>='a'&&str[i]<='z' || str[i]>='A'&&str[i]<='Z')
letter++;
else if(str[i]>='0'&&str[i]<='9')
number++;
else if(str[i]==' ')
blank++;
else
other++;
}
}
int main()
{
char a[80];
gets(a);
puts(a);
strcat(a,"\0");
letter=0;
number=0;
blank=0;
other=0;
count(a);
printf("\n%5d,%5d,%5d,%5d\n",letter,number,blank,other);
return 0;
}
#include <string.h>
int letter,number,blank,other;
void count(char str[])
{
int i;
for(i=0;str[i]!='\0';i++)
{
if(str[i]>='a'&&str[i]<='z' || str[i]>='A'&&str[i]<='Z')
letter++;
else if(str[i]>='0'&&str[i]<='9')
number++;
else if(str[i]==' ')
blank++;
else
other++;
}
}
int main()
{
char a[80];
gets(a);
puts(a);
strcat(a,"\0");
letter=0;
number=0;
blank=0;
other=0;
count(a);
printf("\n%5d,%5d,%5d,%5d\n",letter,number,blank,other);
return 0;
}