1 solutions

  • 0
    @ 2024-3-25 12:11:53

    #include #include

    using namespace std;

    string s; int num[256]; //num[i]记录字符i的出现次数 int maxn = 0;

    int main(){ for (int t=1;t<=4;t++){ getline(cin,s); for (int i=0;i<s.length();i++) if (s[i]>='A' && s[i]<='Z') num[ s[i] ]++, maxn = max(num[s[i]], maxn); }

    for (int i=maxn;i>=1;i--){
    	for (int j='A';j<='Z';j++)
    		if (num[j]>=i)	
    			printf("* ");
    		else
    			printf("  ");
    	printf("\n");
    }
    
    for (int j='A';j<='Z';j++)
    	printf("%c ",j);
    printf("\n");
    

    }

    • 1

    Information

    ID
    590
    Time
    1000ms
    Memory
    125MiB
    Difficulty
    2
    Tags
    # Submissions
    46
    Accepted
    35
    Uploaded By