[恢]hdu 1219
2011-12-16 10:33:26
地址:http://acm.hdu.edu.cn/showproblem.php?pid=1219
题意:统计小写字母出现的次数。
代码:
# include <stdio.h>
# include <string.h>
char str[100010] ;
int tab[300] ;
int main ()
{
int i;
while (gets(str))
{
memset (tab, 0, sizeof(tab)) ;
for (i = 0 ; str[i] ; i++)
tab[str[i]]++ ;
for (i = 'a' ; i <= 'z' ; i++)
printf ("%c:%d\n", i, tab[i]) ;
printf ("\n") ;
}
return 0 ;
}