1 #include <iostream>
2 #include <vector>
3 #include <cstdio>
4 #include <cstring>
5 #include <algorithm>
6 using namespace std;
7
8 int main(){
9 vector<string> first,second;
10 string a,b;
11 bool exitFlag = false;
12 while(1){
13 getline(cin,a);
14 if(a == "#") {exitFlag=true;break;}
15 getline(cin,b);
16 first.push_back(a);
17 second.push_back(b);
18 }
19 for(int i = 0; i < first.size(); i ++ ){
20 for(int j = 0; j < first[i].length(); j ++){
21 cout<<first[i][j]<<" "<<count(second[i].begin(),second[i].end(),first[i][j])<<endl;
22 }
23 }
24 return 0;
25 }