Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include<cmath>
- #include<algorithm>
- #include<string>
- #include<limits.h>
- #include<list>
- using namespace std;
- int main(){
- string s; cin>>s;
- int cnt=0;
- sort(s.begin(),s.end());
- s.push_back(' ');
- for( int i=0 ; i<s.size()-1 ; i++ ){
- if(s[i]!=s[i+1]){
- cout<<s[i]<<" : "<<cnt+1<<endl;
- cnt=0;
- }
- else {
- cnt++;
- cout<<s[i]<<" : "<<cnt+1<<endl;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment