2 solutions
-
0
#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; } -
0
#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 mv=0; for(int i=0;i<26;i++) { mv=max(mv,st[i]); } for(int i=mv;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; }
- 1
Information
- ID
- 88
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 3
- Tags
- # Submissions
- 128
- Accepted
- 40
- Uploaded By