#include <iostream> #include <cstring> #include <string> #include <vector> #include <sstream> using namespace std; vector<char> inp; int findchar(char x,string y){ int r=0; for(int i=0;i<y.length();i++){ if(x==y[i]) r++; } return r; } int main() { string x; while(getline(cin, x) && x!="#"){ inp.clear(); for(int i=0;i<x.length();i++){ inp.push_back(x[i]); } string sentence; getline(cin,sentence); for(int i=0;i<inp.size();i++){ int r=findchar(inp[i],sentence); cout<<inp[i]<<' '<<r<<endl; } } }