#include<iostream> #include<string> #include<algorithm> using namespace std; int C_time(string str,char pattern) { int pos = 0; int count = 0; pos = str.find(pattern, pos); while (pos != str.npos) { count++; pos = str.find(pattern, pos+1); } return count; } int main() { string str1, str2; while (getline(cin,str1)) { if (str1 == "#") { break; } getline(cin, str2); for (int i = 0; i < str1.size(); i++) { int times = C_time(str2, str1[i]); printf("%c %d\n",str1[i],times); } } }