4 solutions

  • 3
    @ 2025-1-25 10:18:39
    #include<bits/stdc++.h>
    using namespace std;
    int st[30];
    const int N=110;
    char str[N];
    int main()
    {
        for(int i=0;i<4;i++)
        {
            cin.getline(str,N);
            int n=strlen(str);
            for(int j=0;j<n;j++)
            {
                if(str[j]>='A'&&str[j]<='Z')
                {
                    int t=str[j]-'A';
                    st[t]++;
                }
            }
        }
        int maxv=0;
        for(int i=0;i<26;i++)
        {
            maxv=max(maxv,st[i]);
        }
        for(int i=maxv;i>=1;i--)
        {
            for(int j=0;j<26;j++)
            {
                if(st[j]>=i) cout<<"* ";
                else cout<<"  ";
            }
            cout<<endl;
        }
        for(int i=0;i<26;i++)
            cout<<char('A'+i)<<" ";
        return 0;
    }
    
  • 0
    @ 2026-2-9 11:33:52
    ENU
    OTB
    ZXK
    DSZ
                                                      *
      *   * *           *     * *       * * *     *   *
    A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
    
    • -1
      @ 2024-6-5 18:47:16
      #include<bits/stdc++.h>
      using namespace std;
      int st[30];
      const int N=110;
      char str[N]; 
      int main()
      {
      	for(int i=0;i<4;i++)
      	{
      		cin.getline(str,N);
      		int n=strlen(str);
      		for(int j=0;j<n;j++)
      		{
      			if(str[j]>='A'&&str[j]<='Z')
      			{
      				int t=str[j]-'A';
      				st[t]++; 
      			 } 
      		}
      	}
          int maxv=0;
      	for(int i=0;i<26;i++)
      	{
      		maxv=max(maxv,st[i]);
      	}
      	for(int i=maxv;i>=1;i--) 
      	{
      		for(int j=0;j<26;j++)
      		{
      			if(st[j]>=i)
      			{
      				cout<<"* ";
      			} 
      			else
      			{
      				cout<<"  ";
      			}
      		}
      		cout<<endl; 
      	}
      	for(int i=0;i<26;i++)
      	{
      		cout<<char('A'+i)<<" "; 
      	}			
      	return 0;
      }
      
      • -2
        @ 2024-7-9 16:28:24
        #include <bits/stdc++.h>
        using namespace std;
        const int N=105;
        char a[N];
        int b[N];
        int main()
        {
        	int maxv=0,z;
        	for(int i=1;i<=4;i++)
        	{
        		cin.getline(a,N);
        		int n=strlen(a);
        		for(int j=0;j<n;j++)
        		{
        			b[int(a[j])]++;
        		}
        	}
        	for(int l=65;l<=90;l++)
        	{
        		if(maxv<=b[l])
        		{
        			maxv=b[l];
        		}
        	}
        	for(int i=1;i<=maxv;i++)
        	{
        		for(int j=65;j<=90;j++)
        		{
        			z=maxv-b[j];
        			if(i-1>=z)
        			{
        				cout<<"*"<<" ";
        			}
        			else
        			{
        				cout<<" "<<" "; 
        			}
        		}
        		cout<<endl;
        	}
        	for(int i=65;i<=90;i++)
        	{
        		cout<<char(i)<<" ";
        	}
        	return 0;
        }
        
        • 1

        Information

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