描述
In your job at Albatross Circus Management (yes, it's run by a bunch of clowns), you have just finished writing a program whose output is a list of names in nondescending order by length (so that each name is at least as long as the one preceding it). However, your boss does not like the way the output looks, and instead wants the output to appear more symmetric, with the shorter strings at the top and bottom and the longer strings in the middle. His rule is that each pair of names belongs o
#include<stdio.h>
int main()
{
int n,i,set=1;
char str[16][26];
while(scanf("%d",&n)&&n!=0)
{
for(i=1;i<=n;i++)
{
scanf("%s",&str[i]);
}
printf("SET %d\n",set);
set++;
if(n%2==0)
{
for(i=1;i<=n;)
{
printf("%s\n",str[i]);
i=i+2;
}
for(i=n;i>0;)
{
printf("%s\n",str[i]);
i=i-2;
}
}
else
{
for(i=1;i<=n;)
{
printf("%s\n",str[i]);
i=i+2;
}
for(i=n-1;i>0;)
{
printf("%s\n",str[i]);
i=i-2;
}
}
}
return 0;
}