Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
help...........++!!help #include<iostream>//2136 using namespace std; int main() { int i,j; int sum[27],k=0,t; char b[75][27]; char a[5][75]; for(i=0;i<26;i++) { sum[i]=0; } for(i=1;i<=4;i++) { gets(a[i]); getchar; for(j=0;j<strlen(a[i]);j++) { sum[a[i][j]-'A']++; if(sum[a[i][j]-'A']>k&&a[i][j]-'A'>=0&&a[i][j]-'A'<26) { k=sum[a[i][j]-'A']; } } } for(i=0;i<26;i++) { for(j=0;j<=sum[i];j++) { b[k-j][i]='*'; } } for(i=0;i<k;i++) { for(j=0;j<26;j++) { t=0; for(int i1=j;i1<26;i1++) { if(b[i][i1]=='*') { t=1; } } if(t==0) break; if(b[i][j]=='*') { cout<<b[i][j]; t=0; for(int i1=j+1;i1<26;i1++) { if(b[i][i1]=='*') { t=1; } } if(j!=25&&t==1) { cout<<" "; } } else { cout<<" "; } } cout<<endl; } for(i=0;i<25;i++) { cout<<char('A'+i)<<" "; } cout<<"Z"<<endl; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator