#include <iostream>
#include <string>
using namespace std;
int main() {
string target;
while ( getline(cin, target)) {
if (target == "#") break;
string str;
getline(cin, str);
for (int i = 0; i < target.size(); i++) {
int count = 0;
for (int j = 0; j < str.size(); j++) {
if (str[j] == target[i]) {
count++;
}
}
cout << target[i] << " " << count << endl;
}
getline(cin, target);
}
}
// 64 位输出请用 printf("%lld")

京公网安备 11010502036488号