#include <iostream>
#include <string>
using namespace std;
int main() {
string s1, s2;
while (getline(cin, s1)) { // 注意 while 处理多个 case
if (s1 == "#") {
break;
}
getline(cin, s2);
for (int i = 0; i < s1.size(); i++) {
cout << s1[i] << " ";
int k = 0;
for (int j = 0; j < s2.size(); j++) {
if (s1[i] == s2[j]) {
k++;
}
}
cout << k << endl;
}
}
}
// 64 位输出请用 printf("%lld")

京公网安备 11010502036488号