1 #include <cstdio>
2 #include <cstdlib>
3 #include <cstring>
4 #include <string>
5 #define MAX 202
6 char key[MAX];
7 char toDeal[MAX];
8 int ans[MAX];
9
10 int main(int argc, char const *argv[])
11 {
12 gets(key);
13 while(strcmp(key, "#") != 0) {
14 gets(toDeal);
15 for(int i = 0; i < strlen(key); i++) {
16 ans[i] = 0;
17 }
18 for(int i = 0; i < strlen(toDeal); i++) {
19 for(int j = 0; j < strlen(key); j++) {
20 if(toDeal[i] == key[j]) {
21 ans[j]++;
22 break;
23 }
24 }
25 }
26 for(int i = 0; i < strlen(key); i++) {
27 printf("%c %d\n",key[i],ans[i]);
28 }
29 gets(key);
30 }
31 return 0;
32 }