现在OJ的题开始有水准了,从1066开始我每解决一道题都会来记录一下。加油,生活不易!题目如下:
代码如下:
#include<stdio.h>
int main()
{int i,letter=0,digit=0,other=0;char str[100];gets(str);for(i=0;str[i]!='\0';i++){if(48<=str[i] && str[i]<=57)digit++;else if(65<=str[i] && str[i]<=90)letter++;else if(97<=str[i] && str[i]<=122)letter++;else other++;}printf("letter:%d\n",letter);printf("digit:%d\n",digit);printf("other:%d\n",other);return 0;
}