杭电acm1860
#include <stdio.h>
int main() {
char d1[6];
char c;
int book[6];
int ids, i;
while(~scanf("%c", &c) && c!='#') {
ids = 0;
for(i=0; i<6; i++)
book[i] = 0;
while(c != '\n') {
//printf("\n error1 \n");
d1[ids++] = c;
//printf("\n error12 %c error\n", d1[ids-1]);
scanf("%c", &c);
//printf("\n error13 \n");
}
while(scanf("%c", &c)) {
if(c == '\n')
break;
//printf("\n error2 \n");
for(i=0; i<ids; i++)
if(c == d1[i])
book[i] ++;
}
for(i=0; i<ids; i++)
printf("%c %d\n", d1[i], book[i]);
}
return 0;
}
int main() {
char d1[6];
char c;
int book[6];
int ids, i;
while(~scanf("%c", &c) && c!='#') {
ids = 0;
for(i=0; i<6; i++)
book[i] = 0;
while(c != '\n') {
//printf("\n error1 \n");
d1[ids++] = c;
//printf("\n error12 %c error\n", d1[ids-1]);
scanf("%c", &c);
//printf("\n error13 \n");
}
while(scanf("%c", &c)) {
if(c == '\n')
break;
//printf("\n error2 \n");
for(i=0; i<ids; i++)
if(c == d1[i])
book[i] ++;
}
for(i=0; i<ids; i++)
printf("%c %d\n", d1[i], book[i]);
}
return 0;
}