#include <iostream> using namespace std; int main() { string str; string find; while (getline(cin, find)) { if (find == "#") { break; } getline(cin, str); int ASC[128] = {0}; for (int i = 0; i < str.size(); ++i) { ASC[str[i]]++; } for (int i = 0; i < find.size(); ++i) { std::cout << find[i] << ' ' << ASC[find[i]] << std::endl; } } }