#include <iostream> using namespace std; int main() { string str1, str2; char m = ' '; while (getline(cin, str1)) { getline(cin, str2); for (int i = 0; i < str1.size(); i++) { int count = 0; if (str1[i] == '#') break; for (int j = 0; j < str2.size(); j++) { if (str1[i] == str2[j]) count++; } cout << str1[i] << m << count; printf("\n"); } } }