#include <iostream>
#include <string>
#include <cstdio>
using namespace std;
int main() {
string str;
string text;
while (getline(cin, str)) { // 注意 while 处理多个 case
if (str == "#") {
break;
}
getline(cin, text);
for (int i = 0; i < str.size(); i++) {
int count = 0;
for (int j = 0; j < text.size(); j++) {
if (str[i] == text[j]) {
count++;
}
}
printf("%c %d\n", str[i], count);
}
}
}
// 64 位输出请用 printf("%lld")

京公网安备 11010502036488号