题目链接:https://www.nowcoder.com/acm/contest/136/D
#include <iostream>
#include <cstring>
#include <cstdio>
#include <map>
using namespace std;
map<char,int>mp;
int ans[1000010];
int main() {
int n, m, x;
char s;
scanf("%d %d", &n, &m);
getchar();
for(int i = 1; i <= n; i++) {
scanf("%c", &s);
mp[s]++;
ans[i] = mp[s];
}
while(m--) {
scanf("%d", &x);
printf("%d\n", ans[x]);
}
return 0;
}