deushiro

Untitled

Jun 12th, 2020
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main(){
  6.     string s;
  7.     cin >> s;
  8.     vector<int> a(26);
  9.     for(int i = 0; i < s.size() - 1; ++i){
  10.         if(s[i] < 'a' || s[i] > 'z')
  11.             continue;
  12.         a[s[i] - 'a']++;
  13.     }
  14.     for(int i = 0; i < 26; ++i){
  15.         if(!a[i])
  16.             continue;
  17.         char x = i + 'a';
  18.         cout << x << " " << a[i] << endl;
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment