Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "bits/stdc++.h"
- using namespace std;
- int main () {
- ios::sync_with_stdio(false);
- cin.tie(nullptr);
- cout.tie(nullptr);
- string s;
- cin >> s;
- int cnt[26];
- for (int i = 0; i < 26; ++i) cnt[i] = 0;
- int n = (int) s.size();
- for (int i = 0; i < n; ++i) {
- int idx = s[i] - 97;
- cnt[idx]++;
- }
- int m;
- cin >> m;
- for (int i = 1; i <= m; ++i) {
- char c;
- cin >> c;
- int idx = c - 97;
- cout << cnt[idx] << '\n';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement