#include<iostream>
using namespace std;
int main(){
string str;
cin>>str;
//precompute
int hash[26] = {0};
for(int i=0; i<str.size(); i++){
hash[str[i] - 'a']++;
}
int q;
cin>>q;
while(q--){
char c;
cin>>c;
//fetch
cout<<": "<<hash[c - 'a'];
}
return 0;
}
I2luY2x1ZGU8aW9zdHJlYW0+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbWFpbigpewogICAKICAgc3RyaW5nIHN0cjsKICAgY2luPj5zdHI7CiAgIAogICAvL3ByZWNvbXB1dGUKICAgaW50IGhhc2hbMjZdID0gezB9OwogICBmb3IoaW50IGk9MDsgaTxzdHIuc2l6ZSgpOyBpKyspewogICAgICAgaGFzaFtzdHJbaV0gLSAnYSddKys7CiAgIH0KICAgCiAgIAogICBpbnQgcTsgCiAgIGNpbj4+cTsKICAgd2hpbGUocS0tKXsKICAgICAgIGNoYXIgYzsKICAgICAgIGNpbj4+YzsKICAgICAgIC8vZmV0Y2gKICAgICAgIGNvdXQ8PCI6ICI8PGhhc2hbYyAtICdhJ107CiAgIH0KICAgCiAgICByZXR1cm4gMDsKfQ==