#include<stdio.h> #include<stdlib.h> #include<string.h> int main() { int count[52]; int i; char * pstr = (char *)malloc(sizeof(char *)*256); for(i=0;i<52;i++) count[i] = 0; memset(pstr,'\0',256); scanf("%s",pstr); while(*pstr!='\0') { printf("%c",*pstr); if('A'<*pstr && *pstr<'Z') count[*pstr-65]++; if('a'<*pstr && *pstr < 'z') count[*pstr-97+26]++; pstr++; } for(i=0;i<26;i++) printf("%c:%d\n",i+65,count[i]); for(i=26;i<26+26;i++) printf("%c:%d\n",i-26+97,count[i]); system("pause"); return 0; }
|