Advertisement
newb_ie

Untitled

Oct 15th, 2021
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. #include "bits/stdc++.h"
  2. using namespace std;
  3.  
  4. int main () {
  5. ios::sync_with_stdio(false);
  6. cin.tie(nullptr);
  7. cout.tie(nullptr);
  8. string s;
  9. cin >> s;
  10. int cnt[26];
  11. for (int i = 0; i < 26; ++i) cnt[i] = 0;
  12. int n = (int) s.size();
  13. for (int i = 0; i < n; ++i) {
  14. int idx = s[i] - 97;
  15. cnt[idx]++;
  16. }
  17. int m;
  18. cin >> m;
  19. for (int i = 1; i <= m; ++i) {
  20. char c;
  21. cin >> c;
  22. int idx = c - 97;
  23. cout << cnt[idx] << '\n';
  24. }
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement