#include<cstdio> #include<string> #include<cstring> using namespace std ; int main() { char arr[10]; fgets(arr, 10, stdin); string buf = arr ; buf.pop_back(); int count[10]={0} ; count[buf.size() - 1] = '\0'; char var[80]; fgets(var, 80, stdin); string str = var; str.pop_back(); for (int i = 0; i < buf.size() ; ++i) { for (int j = 0; j < str.size(); ++j) { if (buf[i] == str[j]) { ++count[i]; } } printf("%c %d\n", buf[i], count[i]); } }