#include <stdio.h>
int main(){
char str1[10], str2[100];
while(gets(str1) && str1[0]!='#'){
gets(str2);
int i = 0;
while(str1[i]){
int j=0, count=0;
while(str2[j]){
if(str1[i] == str2[j]){
count++;
}
j++;
}
printf("%c %d\n", str1[i], count);
i++;
}
}
return 0;
}
/**************************************************************
Problem: 2183
User: admin
Language: C++
Result: Accepted
Time:9 ms
Memory:1036 kb
****************************************************************/