[恢]hdu 1860

2011-12-16 01:56:14

地址:http://acm.hdu.edu.cn/showproblem.php?pid=1860

题意:中文。。。直接爆。

代码:

# include <stdio.h>
# include <string.h>


int main ()
{
int i, j, tab[10] ;
char s1[10], s2[100] ;
while (gets(s1))
{
if (strcmp(s1, "#") == 0) break ;
gets (s2) ;
memset (tab, 0, sizeof(tab)) ;
for (i = 0 ; s2[i] ; i++)
{
for (j = 0 ; s1[j] ; j++)
if (s2[i] == s1[j]) tab[j]++ ;
}
for (i = 0 ; s1[i] ; i++)
printf ("%c %d\n", s1[i], tab[i]) ;
}
return 0 ;
}



posted @ 2012-01-06 16:36  Seraph2012  阅读(147)  评论(0编辑  收藏  举报