aklsjflj123 sadf918u324 asdf91u32oasdf/.‘;123
23 16 2 4
1 #include "stdio.h" 2 3 int main(int argc, char const *argv[]) 4 { 5 char s[81]; 6 int i, char_count = 0, num_count = 0, space_count = 0, other_count = 0; 7 // scanf("%s", s); 8 gets(s); 9 10 for(i = 0; s[i] != ‘\0‘; i++) 11 { 12 if(s[i] >= ‘A‘ && s[i] <= ‘Z‘ || s[i] >= ‘a‘ && s[i] <= ‘z‘) 13 char_count ++; 14 else if(s[i] >= ‘0‘ && s[i] <= ‘9‘) 15 num_count ++; 16 else if(s[i] == ‘ ‘) 17 space_count ++; 18 else 19 other_count ++; 20 } 21 22 printf("%d %d %d %d\n", char_count, num_count, space_count, other_count); 23 return 0; 24 }
原文:http://www.cnblogs.com/hello-lijj/p/7827640.html