Advertisement
newb_ie

Untitled

Oct 12th, 2021
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 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. //~ vector<int> a = {1,2,1,2,1,3,5};
  9. //~ int n = (int) a.size();
  10. //~ int count[6];
  11. //~ for (int i = 0; i < 6; ++i) {
  12. //~ count[i] = 0;
  13. //~ }
  14. //~ for (int i = 0; i < n; ++i) {
  15. //~ count[a[i]]++;
  16. //~ }
  17. //~ cout << count[2] << '\n';
  18. string s = "abcdddddez";
  19. int n = (int) s.size();
  20. int count[26];
  21. for (int i = 0; i < 26; ++i) count[i] = 0;
  22. for (int i = 0; i < n; ++i) {
  23. count[s[i] - 'a']++;
  24. }
  25. cout << count['z' - 'a'] << '\n';
  26. }
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement