Read below statement.
Output an empty line between cases
Moderator: Board moderators
Output an empty line between cases
Hi,Pay attention to Output an empty line between cases ,please!ankit.arora wrote:hi! I am getting WA can anyone please help me out..... here's my code!Thanks!!!!Code: Select all
#include<iostream> using namespace std; int main() { int n,i,j,count,max,temp,prev; int arr[10010]; while(cin>>n) { if(n==0) break; for(i=0;i<n;i++) cin>>arr[i]; for(i=0;i<n;i++) { for(j=i;j<n;j++) { if(arr[i]>arr[j]) { temp=arr[j]; arr[j]=arr[i]; arr[i]=temp; } } } max=1; count=1; for(i=1;i<n;i++) { if(arr[i-1]==arr[i]) count++; else if(count>max) { max=count; count=1; } else count=1; } cout<<max<<"\n"; for(i=0;i<max;i++) { cout<<arr[i]; for(j=i+max;j<n;j+=max) cout<<" "<<arr[j]; cout<<"\n"; } cout<<"\n"; } }