Advertisement
semsem_elazazy

Untitled

Feb 11th, 2022
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.38 KB | None | 0 0
  1. #include <iostream>
  2. #include<bits/stdc++.h>
  3. #define ll long long
  4. using namespace std;
  5.  
  6. int main() {
  7.  string s;
  8.  cin>>s;
  9.  sort(s.begin(),s.end());
  10.  int len =s.size();
  11.  for(int i=0 ;i<len ;i++)
  12.  {
  13.      char c= s[i];
  14.      int cntr;
  15.      while(s[i]==s[++i])
  16.      {
  17.          cntr++;
  18.      }
  19.      i--;
  20.      cout<<c<<" : "<<cntr;
  21.      cout<<endl;
  22.      
  23.  }
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement