2 solutions

  • 0
    @ 2026-8-14 19:45:17
    #include<bits/stdc++.h>
    using namespace std;
    int a[30];
    int main()
    {
    	string s;
    	int maxx=-1;
    	while(cin>>s){
    		for(int i=0;i<s.size();i++){
    			if(s[i]>='A'&&s[i]<='Z')	
    				a[s[i]-'A'+1]++;
    		}
    
    	}
    	
    	for(int i=1;i<=26;i++){
    		maxx=max(maxx,a[i]);
    	}
    	for(int i=maxx;i>=1;i--){
    		for(int j=1;j<=26;j++){
    			if(a[j]>=i)	cout<<"*";
    			else cout<<" ";
    			cout<<" ";
    		}
    		cout<<endl;
    	}
    	for(char i='A';i<='Z';i++){
    		cout<<i<<" ";
    	}
    	
    	return 0;
    }
    

    Information

    ID
    88
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    3
    Tags
    # Submissions
    128
    Accepted
    40
    Uploaded By