int main()
{
	int money;
	scanf("%d",&money);
	int ge,shi,bai;
	int a,b,c,d,e,f;
	ge=money%10;
	shi=(money%100-(money%100)%10)/10;
	bai=money/100;
	a=bai;
	switch(shi){
	case 0:
		b=0;c=0;d=0;break;
	case 1:
		b=0;c=0;d=1;break;
	case 2:
		b=0;c=1;d=0;break;
	case 3:
		b=0;c=1;d=1;break;
	case 4:
		b=0;c=2;d=0;break;
	case 5:
		b=1;c=0;d=0;break;
	case 6:
		b=1;c=0;d=1;break;
	case 7:
		b=1;c=1;d=0;break;
	case 8:
		b=1;c=1;d=1;break;
	case 9:
		b=1;c=2;d=0;break;
	default:
		break;
	}
	switch(ge){
	case 0:
		e=0;f=0;break;
	case 1:
		e=0;f=1;break;
	case 2:
		e=0;f=2;break;
	case 3:
		e=0;f=3;break;
	case 4:
		e=0;f=4;break;
	case 5:
		e=1;f=0;break;
	case 6:
		e=1;f=1;break;
	case 7:
		e=1;f=2;break;
	case 8:
		e=1;f=3;break;
	case 9:
		e=1;f=4;break;
	default:
		break;
	}
	printf("%d\n%d\n%d\n%d\n%d\n%d",a,b,c,d,e,f);
	return 0;
}


/*
 * ?????.cpp
 *
 *  Created on: 2011-11-6
 *      Author: ???
 */

int main(){
	int total,counter=0;//total???????counter??????????
	cin>>total;
	while(total>=100){//???????100????100?????????100????+1
		total=total-100;
		counter++;
	}
	cout<<counter<<endl;//?????
	counter=0;          //??????????
	while(total>=50){
		total=total-50;
		counter++;
	}
	cout<<counter<<endl;
	counter=0;
		while(total>=20){
			total=total-20;
			counter++;
		}
		cout<<counter<<endl;
		counter=0;
			while(total>=10){
				total=total-10;
				counter++;
			}
			cout<<counter<<endl;
			counter=0;
				while(total>=5){
					total=total-5;
					counter++;
				}
				cout<<counter<<endl;
				cout<<total<<endl;//????1??????????????
	return 0;
}


int main()
{
	int n;
	scanf("%d",&n);

	int bai;
	bai=n/100;
	if(bai>0){
		printf("%d\n",bai);
		n=n-bai*100;
	}
	else printf("0\n");

	int wushi;
	wushi=n/50;
	if(wushi>0){
		printf("%d\n",wushi);
		n=n-wushi*50;
	}
	else printf("0\n");

	int ershi;
    ershi=n/20;
	if(ershi>0){
		printf("%d\n",ershi);
		n=n-ershi*20;
	}
	else printf("0\n");

	int shi;
	shi=n/10;
    if(shi>0){
		printf("%d\n",shi);
		n=n-shi*10;
	}
	else printf("0\n");

	int wu;
	wu=n/5;
    if(wu>0){
		printf("%d\n",wu);
		n=n-wu*5;
	}
	else printf("0\n");

	int yi;
	yi=n;
    if(yi>0){
		printf("%d\n",yi);
	}
	else printf("0\n");

	return 0;
}


int main()
{
	int a , b , c , cash;
	int t;
	cin >> cash;
	t = cash;
	c = cash % 10 ;
	t = t / 10 ;
	b = t % 10 ; t = t/10;
	a = t % 10;
	cout << a << endl;
	switch( b )
	{
	case 9:cout<<1<<endl<<2<<endl<<0<<endl;break;
	case 8:cout<<1<<endl<<1<<endl<<1<<endl;break;
	case 7:cout<<1<<endl<<1<<endl<<0<<endl;break;
	case 6:cout<<1<<endl<<0<<endl<<1<<endl;break;
	case 5:cout<<1<<endl<<0<<endl<<0<<endl;break;
	case 4:cout<<0<<endl<<2<<endl<<0<<endl;break;
	case 3:cout<<0<<endl<<1<<endl<<1<<endl;break;
	case 2:cout<<0<<endl<<1<<endl<<0<<endl;break;
	case 1:cout<<0<<endl<<0<<endl<<1<<endl;break;
	case 0:cout<<0<<endl<<0<<endl<<0<<endl;break;
	default:break;
	}

	if ( c >= 5 )
	{
		cout <<1<<endl<<c-5<<endl;
	}
	else
		cout<<0<<endl<<c<<endl;
	return 0;
}


int main(){
   int n;
   scanf("%d",&n);
   int s=n/100;
   int t=n%100;
   int y=t/50;
   int u=t%50;
   int a=u/20;
   int b=u%20;
   int c=b/10;
   int d=b%10;
   int e=d/5;
   int f=d%5;
   printf("%d\n%d\n%d\n%d\n%d\n%d\n",s,y,a,c,e,f);
return 0;
}


int main()
{int n,a,b,c,d,e,f;
cin>>n;
a=n/100;
cout<<a<<endl;
if(a!=0)
	n=n-100*a;
else n=n;
b=n/50;
cout<<b<<endl;
if(b!=0)
n=n-50*b;
else
	n=n;
c=n/20;
cout<<c<<endl;
if(c!=0)
	n=n-20*c;
else n=n;
d=n/10;
cout<<d<<endl;
if(d!=0)
	n=n-d*10;
else n=n;
e=n/5;
cout<<e<<endl;
if(e!=0)
	n=n-5*e;
else  n=n;
f=n;
cout<<f<<endl;
	return 0;}


int main()
{
	int n;
	int hundred,fifty,twenty,ten,five,one;
	cin >> n;
	hundred=n/100;
	fifty=n%100/50;
	twenty=n%50/20;
	ten=n%50%20/10;
	five=n%10/5;
	one=n%5;
	cout << hundred << endl << fifty << endl << twenty << endl << ten << endl << five << endl << one;
	return 0;
}


int main()
{
	int money=0,a=0;
	cin>>money;
	a=money/100;
	cout<<a<<endl;
	money=money%100;
	a=money/50;
	cout<<a<<endl;
	money=money%50;
	a=money/20;
	cout<<a<<endl;
	money=money%20;
	a=money/10;
	cout<<a<<endl;
	money=money%10;
	a=money/5;
	cout<<a<<endl;
	money=money%5;
	cout<<money;
	return 0;
}


int main()
{
    int money;
    cin>>money;
    int num[6]={0};

    while(money>=100)
    {
        money=money-100;
        num[0]=num[0]+1;
    }
    while(money>=50)
    {
        money=money-50;
        num[1]=num[1]+1;
    }
    while(money>=20)
    {
        money=money-20;
        num[2]=num[2]+1;
    }
    while(money>=10)
    {
        money=money-10;
        num[3]=num[3]+1;
    }
    while(money>=5)
    {
        money=money-5;
        num[4]=num[4]+1;
    }
    while(money>=1)
    {

        money=money-1;
        num[5]=num[5]+1;
    }
    int i;
    for(i=0;i<6;i++)
    {
        cout<<num[i]<<endl;
    }

    return 0;
}


int main()
{
	int sum;
	int p;
	cin>>sum;
	p=sum/100;
	cout<<p<<endl;
	sum=sum-100*p;
	p=sum/50;
	cout<<p<<endl;
	sum=sum-50*p;
	p=sum/20;
	cout<<p<<endl;
	sum=sum-20*p;
	p=sum/10;
	cout<<p<<endl;
	sum=sum-10*p;
	p=sum/5;
	cout<<p<<endl;
	sum=sum-5*p;
	p=sum/1;
	cout<<p<<endl;
	return 0;

}


int main()
{
	int bill, count = 0;
	cin >> bill;
	while (bill > 0)
	{
		cout << bill / 100 << endl;
		bill -= bill / 100 * 100;
		cout << bill / 50 << endl;
		bill -= bill / 50 * 50;
		cout << bill / 20 << endl;
		bill -= bill / 20 * 20;
		cout << bill / 10 << endl;
		bill -= bill / 10 * 10;
		cout << bill / 5 << endl;
		bill -= bill / 5  * 5 ;
		cout << bill  << endl;
		bill -= bill;
	}
	return 0;
}


int main()
{
   int sum;
   cin>>sum;

      if(sum>=100)
	  {
		  cout<<sum/100<<endl;
		  sum=sum-100*(sum/100);
	  }
	  else cout<<0<<endl;
	  if(sum>=50)
	  {
	      cout<<sum/50<<endl;
		  sum=sum-50*(sum/50);
	  }
	  else cout<<0<<endl;
	  if(sum>=20)
	  {
	     cout<<sum/20<<endl;
		 sum=sum-20*(sum/20);
	  }
	  else cout<<0<<endl;
	  if(sum>=10)
	  {
	     cout<<sum/10<<endl;
         sum=sum-10*(sum/10);
	  }
	  else cout<<0<<endl;
	  if(sum>=5)
	  {
	     cout<<sum/5<<endl;
		 sum=sum-5*(sum/5);
	  }
	  else cout<<0<<endl;
	  cout<<sum;

   return 0;
}


int main()
{
	int money;
	scanf("%d",&money);
	int a,b,c,d,e,f;
	a=money/100;
	b=money%100/50;
	c=money%50/20;
	d=(money%50-c*20)/10;
	e=money%10/5;
	f=money%10-e*5;
	printf("%d\n",a);
	printf("%d\n",b);
	printf("%d\n",c);
	printf("%d\n",d);
	printf("%d\n",e);
	printf("%d\n",f);
}


int main(int argc, char* argv[])
{
	int n,bai=0,wushi=0,ershi=0,shi=0,wu=0,yi=0;
	scanf("%d",&n);
	bai=n/100;
	n=n%100;
	wushi=n/50;
	n=n%50;
	while (n>=20)
	{
		ershi+=1;
		n=n-20;
	}
	if (n>=10){
	shi=n/10;
	n=n-10;}
	if (n>=5)
	{
		wu=1;
		n=n-5;
	}
	yi=n;
	printf("%d\n%d\n%d\n%d\n%d\n%d\n",bai,wushi,ershi,shi,wu,yi);
	return 0;
}


int main ()
{
	int n;
	int bai,wushi,ershi,shi,wu,yuan;
	scanf("%d",&n);
	bai=(n-n%100)/100;
	printf("%d\n",bai);
	wushi=((n-100*bai)-(n-100*bai)%50)/50;
	printf("%d\n",wushi);
	ershi=((n-100*bai-50*wushi)-(n-100*bai-50*wushi)%20)/20;
	printf("%d\n",ershi);
	shi=((n-100*bai-50*wushi-20*ershi)-(n-100*bai-50*wushi-20*ershi)%10)/10;
	printf("%d\n",shi);
	wu=((n-100*bai-50*wushi-20*ershi-10*shi)-(n-100*bai-50*wushi-20*ershi-10*shi)%5)/5;
	printf("%d\n",wu);
	yuan=n-100*bai-50*wushi-20*ershi-10*shi-5*wu;
	printf("%d\n",yuan);
	return 0;
}


int main()
{
   int n,yibai=0,wushi=0,ershi=0,yishi=0,wu=0,yi=0;
   scanf("%d",&n);
   int a,b;
      a=n%10;
	  b=(n/10)%10;

	  if(a<5){
	  yi=a;
	  wu=0;
	  }
      else{
	   yi=a-5;
	   wu=1;
   }

      if(b<5){
	   ershi=b/2;
	   yishi=b%2;
	   wushi=0;
   }
       else {
	   wushi=1;
	   ershi=(b-5)/2;
	   yishi=(b-5)%2;
   }
   yibai=n/100;
   printf("%d\n%d\n%d\n%d\n%d\n%d\n",yibai,wushi,ershi,yishi,wu,yi);
	 return 0;
}


int main()
{
    int n,i,shuzu[111],count1=0,count3=0,count2=0,count4=0,count5=0,count6=0;
    scanf("%d",&n);
    while(n>=100){
                  n=n-100;
                  count1++;
                  }
                      while(n>=50){
                  n=n-50;
                  count2++;
                  }
                      while(n>=20){
                  n=n-20;
                  count3++;
                  }
                      while(n>=10){
                  n=n-10;
                  count4++;
                  }    while(n>=5){
                  n=n-5;
                  count5++;
                  }
                      while(n>=1){
                  n=n-1;
                  count6++;
                  }
               printf("%d\n%d\n%d\n%d\n%d\n%d",count1,count2,count3,count4,count5,count6);
               return 0;
               }


int sort(int a,int b);
int main(){
    int money;
    scanf("%d",&money);
    money=sort(money,100);
    money=sort(money,50);
    money=sort(money,20);
    money=sort(money,10);
    money=sort(money,5);
    money=sort(money,1);
    return 0;
}
int sort(int a,int b){
    printf("%d\n",a/b);
    return a%b;
}


int main(){
   int num,a,b,c,d,e,f;
   int sz[6]={100,50,20,10,5,1};

   scanf("%d",&num);
   a=num/sz[0];
   num=num-a*100;
	   b=num/sz[1];
	   num=num-b*50;
	   c=num/sz[2];
	   num=num-c*20;
	   d=num/sz[3];
	   num=num-d*10;
	   e=num/sz[4];
	   num=num-e*5;
	   f=num;
	   printf("%d\n%d\n%d\n%d\n%d\n%d\n",a,b,c,d,e,f);
	return 0;
}


int main(int argc, char* argv[])
{
int a;
cin>>a;
int b,c,d,e,f,g;
b=a/100;
a=a-100*b;
c=a/50;
a=a-50*c;
d=a/20;
a=a-20*d;
e=a/10;
a=a-10*e;
f=a/5;
a=a-5*f;
g=a;
cout<<b<<endl;
cout<<c<<endl;
cout<<d<<endl;
cout<<e<<endl;
cout<<f<<endl;
cout<<g<<endl;

}


int main()
{
	int note100=0,note50=0,note20=0,note10=0,note5=0,note1=0,i,j,money;
	cin>>money;
	while(money>=100)
	{
		money=money-100;
		note100++;
	}
	while(money>=50)
	{
		money=money-50;
		note50++;
	}while(money>=20)
	{
		money=money-20;
		note20++;
	}while(money>=10)
	{
		money=money-10;
		note10++;
	}while(money>=5)
	{
		money=money-5;
		note5++;
	}while(money>=1)
	{
		money=money-1;
		note1++;
	}
	cout<<note100<<endl<<note50<<endl<<note20<<endl<<note10<<endl<<note5<<endl<<note1;
	return 0;
}


int main(){
    int money;
	int a,b,c,d,e,f;
	int g,h,i,j,k,l;
	scanf("%d",&money);
	a=money-money%100;
	b=money-(money-a)%50-a;
	c=money-(money-a-b)%20-a-b;
	d=money-(money-a-b-c)%10-a-b-c;
	e=money-(money-a-b-c-d)%5-a-b-c-d;
	f=money-(money-a-b-c-d-e)%1-a-b-c-d-e;
	g=a/100;
	h=b/50;
	i=c/20;
	j=d/10;
	k=e/5;
	l=f/1;
	printf("%d\n%d\n%d\n%d\n%d\n%d\n",g,h,i,j,k,l);
	return 0;
}


int main()
{
	int number,i=0,a=0,b=0,c=0,d=0,e=0,f=0;
	cin>>number;
	for (i=0; ;i++)
	{
		if (number>=100)
		{
			a=number/100;
			number=number-100*a;
		}

		if (number<100 && number>=50)
		{
			b=number/50;
			number=number-50*b;
		}

		if (number<50 && number>=20)
		{
			c=number/20;
			number=number-20*c;

		}
		if (number<20 && number>=10)
		{
			d=number/10;
			number=number-10*d;
		}
		if (number<10 && number>=5)
		{
			e=number/5;
			number=number-5*e;
		}
		if (number<5 && number>0)
		{
			f=number;
			break;
		}
		if (number<=0)
			break;
	}
	cout<<a<<endl;
	cout<<b<<endl;
	cout<<c<<endl;
	cout<<d<<endl;
	cout<<e<<endl;
	cout<<f<<endl;
	return 0;
}


int main()
{
	int n, a, b, c, d, e;
	cin >> n;

	a = n/100;
	if (a != 0 )
	{
		cout << a << endl;
		n = n % 100;
	}
	else cout << "0" << endl;

	b = n / 50;
	if (b != 0)
	{
		cout << b << endl;
		n = n % 50;
	}
	else cout << "0" << endl;

	c = n / 20;
	if (c != 0)
	{
		cout << c << endl;
		n = n % 20;
	}
	else cout << "0" << endl;

	d = n / 10;
	if (d != 0)
	{
		cout << d << endl;
		n = n % 10;
	}
	else cout << "0" << endl;

	e = n / 5;
	if (e != 0)
	{
		cout << e << endl;
		n = n % 5;
	}
	else cout << "0" << endl;

	cout << n << endl;
	return 0;
}


int main()
{
	int n,t;
	scanf("%d",&n);
	{
		t=n/100;
	    if(t>0)
		printf("%d\n",t);
		else
		printf("0\n");
		n=n-100*t;
	    t=n/50;
		if(t>0)
	    printf("%d\n",t);
		else
		printf("0\n");
		n=n-50*t;
        t=n/20;
	    if(t>0)
	    printf("%d\n",t);
		else
		printf("0\n");
	    n=n-20*t;
	    t=n/10;
		if(t>0)
	    printf("%d\n",t);
		else
		printf("0\n");
		n=n-10*t;
	    t=n/5;
		if(t>0)
	    printf("%d\n",t);
		else
		printf("0\n");
		n=n-5*t;
        if(n>0)
	    printf("%d\n",n);
		else
		printf("0\n");
		return 0;
	}
}


int main(int argc, char* argv[])
{
	char word[41],words[41];
	int n,s=0,l,i,x=90;
	scanf("%d",&n);
	for (i=1;i<=n;i++)
	{
		scanf("%s",word);
		l=strlen(word);
		if (i==1) {s=l;printf("%s",word);continue;}
		s=s+l+1;
		if (s<=80) printf(" %s",word);
		else {printf("\n%s",word);s=l;}

	}
	return 0;
}


void compose_word(char word[1000][25], int number)
{
	int count = 0, len = 0, first = 0, i = 0;//count????????????????len?????????,first?????????
	len = strlen(word[0]);
	for (i = 0; i < number;)
	{
		while (len + count < 80)
		{
			if (first)
			{
				cout << ' ';
				count ++;
			}
			else
				first = 1;
			cout << word[i];
			count += len;
			i ++;
			if (i >= number)
				break;
			len = strlen(word[i]);
		}
		cout << endl;
		count = 0;
		first = 0;
		if (i >= number)
			break;
	}
}
int main()
{
	int number = 0, i;//number????????
	cin >> number;
	getchar();
	char word[1000][25] = {'\0'};
	for (i = 0; i < number; i ++)
		scanf("%s",word[i]);
	compose_word(word,number);//????
	return 0;
}


/*
 * word.cpp
 *
 *  Created on: 2011-12-11
 *      Author: wangshiheng
 */

int main()
{
	char words[41];
	int s=-1,l,n,i;
	cin>>n;
	for (i=0;i<n;i++)
	{
		cin>>words;
		l=strlen(words);
			if (s==-1){s=l+s+1;cout<<words;}
			else if (s+l+1<=80){s=l+s+1;cout<<' '<<words;}
			else {s=l;cout<<endl;cout<<words;}
	}

	return 0;
}


int main(int argc, char* argv[])
{
    int n,i,m,count=0,k=0;
	char c[40];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s",c);
        m=strlen(c);

		count=count+m+1;
		if(count-1>80)
		{
			printf("\n%s",c);
			count=m+1;

		}
		else
		{
			if(k==0)
			{
              printf("%s",c);
			  k=1;
			}
			else
			printf(" %s",c);
		}
	}
	return 0;
}


void main()
{
 char word[50];
 int a=0,b=0,c,d,i,n,j,k;
 scanf("%d",&n);
 scanf("%s",word);
  a=strlen(word)+1;
  b=b+a;
  printf("%s",word);
 for(i=1;i<n;i++)
 {
  scanf("%s",word);
  a=strlen(word)+1;
  b=b+a;
  if(b<=81) printf(" %s",word);
   if(b>81)
  {
   printf("\n%s",word);
   b=a;
  }
 }
}


int main()
{
	char verb[42], m;
	int num, size, sum = 0;
	cin >> num;
	while (1)
	{
		cin >> verb;
		m = cin.get();
		size = strlen(verb);
		if (sum == 0)
		{
			cout << verb;
			sum += size;
		}
		else
		{
			sum += (size + 1);
			if (sum <= 80)
			{
				cout << " " << verb;
			}
			else
			{
				cout << endl;
				cout << verb;
				sum = size;
			}
		}
		if (m == '\n')
			break;
	}
	return 0;
}


int main()
{
	int n;
	cin>>n;
	char p[1][20];
	cin>>(*p);
	int len=strlen(*p);
	cout<<(*p);
	for(int i=1;i<n;i++)
	{
		cin>>(*p);
		if(len+strlen(*p)+1>80)
		{
			cout<<endl<<(*p);
			len=strlen(*p);
		}
		else
		{
			cout<<' '<<(*p);
			len+=strlen(*p)+1;
		}
	}
	return 0;
}


/*
 * assignment.cpp
 *
 *  Created on: 2010-11-23
 *      Author: ??
 *      ????
 */
//???
int main() {
	int n;
	cin >> n;
	char word[100];
	unsigned int len = 0;
	for (int i = 0; i < n; i++) {
		cin >> word;
		len = len + strlen(word)+1 ;
		if (len == strlen(word) + 1){
			cout << word;
			len--;
		}
		else if (len <= 80)
			cout << " " << word;
		else {
			cout << endl << word;
			len = strlen(word) ;
		}
	}
	return 0;
}


const int maxlen=80;

char st[50];

int n, len, newline, nowlen;

int main(){

	//freopen("a.in", "r", stdin);
	scanf("%d", &n);
	newline = 1;
	for (int i=0; i<n; i++){
		scanf("%s", st);
		nowlen = strlen(st);
		if ((i?1:0)+nowlen+len > maxlen){
			printf("\n%s", st);
			len = nowlen;
		}
		else {
			if (i) putchar(' ');
			printf("%s", st);
			len += (i?1:0) + nowlen;
		}
	}

	return 0;
}


struct word
{
	char str[50];
	int a;
	struct word *next;
}w[10000];
int main()
{
	struct word *head,*p1,*p2,*p;
	int n,i=0,t=0;
	scanf("%d", &n);
	p1=p2=(struct word *)malloc(len);
	 scanf("%s",p1->str);
	p1->a=strlen(p1->str);
	head=NULL;
	while(i<n-1)
	{
		i++;
		if(i==1)
		  head=p1;
		p1=(struct word *)malloc(len);
	    scanf("%s",&p1->str);
     	p1->a=strlen(p1->str);
	    p2->next=p1;
		p2=p1;
	}
	p2->next=NULL;
	p=head;
	i=0;
	while(i<n)
	{
	  printf("%s",p->str);
	  i++;
	  t=t+p->a;
	  p=p->next;
	 if(p!=NULL)
	 {
	   while(t+1+p->a<=80)
	   {
		 printf(" ");
	     printf("%s",p->str);
		 i++;
		 t=t+1+p->a;
		 p=p->next;
		 if(p==NULL)
			 break;
	   }
	 }
	   printf("\n");
	   t=0;
	}
	return 0;
}


int main()
{
	char a[50];
	int n,b[1000];
	cin>>n;
	int i,j,k,m,q=0,s=0,para=0,word=0;
	char *p=a;
	cin>>a;cout<<a;//?????
	para=para+strlen(a);
	for(i=1;i<n;i++)
	{
		cin>>a;
		word=strlen(a);
		para=para+strlen(a)+1;
		if(para==strlen(a)+1)
		{
			cout<<a;
			para=para-1;//???????
		}
		else
		{
		if(para<80&&para!=strlen(a)+1)
		{
			cout<<" ";
			for(p=a;p<a+strlen(a);p++)
				cout<<*p;//??????
		}
		if(para==80)
		{
			cout<<" ";
			for(p=a;p<a+strlen(a);p++)
				cout<<*p;
			cout<<endl;//??80???
			para=0;
		}
		if(para>80)
		{
			para=strlen(a);
			cout<<endl;
			for(p=a;p<a+strlen(a);p++)
			cout<<*p;//??????
		}
		}

	}
	return 0;
}


int main()
{
	char word[1000][40]={'\0'};
	int wordlen[1000]={0},i,n,sum=0;	//sum??????????
	cin>>n;
	cin.get();
	for (i=0;i<n;i++)
		cin>>word[i];						//???cin??????
	for (i=0;i<n;i++)
		wordlen[i]=strlen(word[i]);			//?????????
	cout<<word[0];
	sum=wordlen[0];
	for (i=1;i<n;i++)
	{
		if ((wordlen[i]+1+sum)<=80)
		{
			cout<<" "<<word[i];
			sum=sum+wordlen[i]+1;
		}
		else
		{
			cout<<endl;
			sum=wordlen[i];
			cout<<word[i];
		}
	}
	return 0;
}


int main()
{
	int i, j, n, k = 0, sum = 0, len = 0;
	int flag[100];
	char word[1000][41];
	cin >> n;
	for(i = 0; i < n; i ++)
		cin >> word[i];
	flag[0] = 0;
	for(i = 0; i < n; i ++)
	{
		len = strlen(*(word + i));
		sum += len;
		if(sum + i - flag[k] > 80)
		{
			flag[++ k] = i;
			i --;
			sum = 0;
		}
	}
	flag[k + 1] = n;
	for(i = 0; i <= k; i ++)
	{
		for(j = flag[i]; j < flag[i + 1] - 1; j ++)
		{
			cout << *(word + j) << " ";
		}
		cout << *(word + flag[i + 1] - 1) << endl;
	}
	return 0;
}


int main()
{
	int i,n;
	int count=0,flag=0;
	char word[40];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s",word);
		if(count+strlen(word)+1<=80)
		{
			if(flag==0)
			{
				printf("%s",word);
				flag=1;
				count+=strlen(word);
			}
			else
			{
				printf(" ");
				printf("%s",word);
				count+=strlen(word)+1;
			}

		}
		else
		{
			printf("\n");
			printf("%s",word);
			count=strlen(word);
		}
	}
	return 0;
}


int main()
{
	int n;
	cin >> n;
	char word[600][40];
	char (*p)[40] = word;
	for (int i = 0; i < n ;i++)
		cin >> word[i];
	int sum = 0;
	int flag = 1;
	for (int i = 0; i < n ; i++,p++)
	{
		if (flag)
		{
			sum += strlen(word[i]);
		}
		else
		{
			sum += strlen(word[i]) + 1;
		}
		if (sum <= 80)
		{
			if (flag)
			{
				cout << *p;
				flag = 0;
			}
			else
				cout << " " << *p;
		}
		else
		{
			cout << endl;
			flag = 1;
			sum = 0;
			i--;
			p--;
		}
	}
	return 0;
}


int main()
{
	int n;
	cin>>n;
		char str[1000][40];
	int i;
	for(i=0;i<n;i++)
	{
		cin>>*(str+i);
	}
	int len;

	for(i=0;i<n;i++)
	{
		len=0;
		while(true)
		{
			len+=strlen(*(str+i));
			if(len+strlen(*(str+i+1))+1>80||i>=n)
			{
				cout<<*(str+i)<<endl;
				break;
			}
			else
			{
				cout<<*(str+i);
				if(len+1+strlen(*(str+i+1))<=80&&i<n-1)
				{cout<<" ";len++;}
			}i++;
		}
		//cout<<endl;
	}
	return 0;
}


int main(){
	int n;
	scanf("%d",&n);
	char zfc[1000][42];
	int i;
	for(i=0;i<n;i++){
		scanf("%s",zfc[i]);
	}
	int len=0,k;
	for(i=0;i<n;i++){
        len=len+strlen(zfc[i])+1;
	  if(i<n-1){
		if(len<=80){
            k=len+strlen(zfc[i+1])+1;
			if(k>81){
				 printf("%s",zfc[i]);
			}
			if(k<=81){
				 printf("%s ",zfc[i]);
			}
		}
		if(len==81){
			printf("%s\n",zfc[i]);
			len=0;
		}
		if(len>81){
			printf("\n%s ",zfc[i]);
			len=strlen(zfc[i])+1;
		}
	  }
	  if(i==n-1){
		  printf("%s",zfc[n-1]);
	  }

	}
	return 0;
}


int main()
{
    int n;
    scanf("%d",&n);
    char word[2000][1000];
    for(int i=0;i<n;i++)
    {
        scanf("%s",word[i]);
    }
    int start=0;
    int count=0;
    for(int i=0;i<n;i++)
    {
        count=count+strlen(word[i]);
        if(count+i-start>80)
        {
            for(int j=start;j<=i-2;j++)
            printf("%s ",word[j]);
            printf("%s\n",word[i-1]);
            start=i;
            i=i-1;
            count=0;
        }
        if(i==n-1&&count+i-start<80)
        {
            for(int j=start;j<=i-1;j++)
            printf("%s ",word[j]);
            printf("%s",word[i]);
        }
    }
    return 0;
}


/*
 * 1.cpp
 *
 *  Created on: 2012-12-10
 *      Author: ???
 *      Function:????
 */

int main() {
	int space;
	cin >> space;
	char str[10000], empty[10];
	int l[1000] = { 0 };
	cin.getline(empty, 10);
	cin.getline(str, 10000);
	int k = strlen(str);

	char *p = str;
	*(p + k) = ' ';
	int *len = l;
	int sum = 0, num = 0;//?????????
	while (sum < space) {

		while (*p != ' ') {
			if (!sum)
				cout << *p;
			p++;
			(*len)++;
		}

		//cout<<*len;
		if (sum) {
			for (char *x = p - *len - 1; x < p; x++) {
				if (num - 1 <= 80 && num + *len > 80) {
					*(p - *len - 1) = '\n';
					num = 0;
				} else if (num + *len <= 80)
					*(p - *len - 1) = ' ';

				cout << *x;
			}
		}
		num += *len + 1;
		//cout << " ";
		p++;
		sum++;
		len++;
		//cout << sum << " " << num;
	}

	return 0;
}


int main()
{
	int n,i;
	int count=0;
	char word[40];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s",word);
		if (count==0)
			printf("%s",word);
		int j=0;
		while (word[j]!='\0')
		{
			j++;
		}
		count=count+j;
		if(count>j)
		{
		if(count<79)
		{
			count++;
			printf(" %s",word);
		}
		else if(count==79)
		{
			printf(" %s\n",word);
			count=0;
		}
		if(count>79)
		{
			printf("\n%s",word);
			count=j;
		}
		}
	}
	return 0;
}


int main()
{
    int n,i;
    cin>>n;
    char word[n][81],c;
    for(i=0;i<n;i++)
    {
        cin>>word[i];
    }
    int sum=strlen(word[0]);
    cout<<word[0];
    for(i=1;i<n;i++)
    {
        if(sum+strlen(word[i])+1<=80)
        {
            if(sum!=-1) cout<<' ';
            cout<<word[i];
            sum=sum+strlen(word[i])+1;
        }
        else
        {
            cout<<endl;
            sum=-1;
            i--;
        }
    }
    return 0;
}


int main()
{
	int n, i, sum = 0, len;
	char c[10000][41];
	char (*p)[41];
	p = c;
	cin >> n;
	for(i = 0;i < n;i++)
		cin >> *(p+i);
	 for(i = 0;i < n;i++)
	 {
		 len = strlen(*(p+i));
		 if(sum + len > 80)
		 {
			 sum = 0;
			 cout << *(p+i) <<' ';
		 }
		 else if(sum + len < 80)
		 {
			 sum = sum + len + 1;
			 len = strlen(*(p+i+1));
			 if(sum + len > 80)
			 {
				 sum = 0;
				 cout << *(p+i);
				 cout << endl;
			 }
			 else if(sum + len < 80)
			 {
				 if(i == n-1)  cout << *(p+i);
				 else cout <<*(p+i) <<' ';
			 }
		 }
		 else if(sum + len == 80)
		 {
			 sum = 0;
			 cout << *(p+i-1) <<' '<< *(p+i) <<endl;
		 }
	 }
	 return 0;
}


int main()
{int n;
cin>>n;
int t=0;
char a[80];
int i,j;
cin>>a;
t=strlen(a)+1;
cout<<a;
for(i=1;i<n;i++)
{cin>>a;
if(t+strlen(a)<=80)
{cout<<' '<<a;
t=t+strlen(a)+1;
}
else
{cout<<endl<<a;
t=strlen(a)+1;
}
}

return 0;

}


int len(char word[81])
{
	char *p;
	p=word;
	int i=0,count=0;
	for(i=0;i<81;i++)
	{
		if(*(p+i)==0)
			break;
		else
			count++;
	}
		return count;
}
int main()
{
	char word[81];
	memset(word,0,sizeof(word));
	int n=0,num=0;
	cin>>n;
	int i=0;
	scanf("%s", word);
	cout<<word;
	num=len(word)+1;
	for(i=2;i<=n;i++)
	{
		scanf("%s", word);
		if(len(word)+num>80)
		{
			cout<<endl;
			cout<<word;
			num=len(word)+1;
		}
		else
		{
			cout<<" "<<word;
			num=num+len(word)+1;
		}
	}
	return 0;
}


char word[200][41];
void pb(char* a,int p,int t)
{
    t += strlen(a);
    if(t > 80)
    {
      printf("\n");
      t=0;
      t += strlen(a);
    }
    else if(t - strlen(a))
     printf(" ");
    printf("%s",a);
    t++;
    if(p)
    pb(word[p-1],p-1,t);
}
int main()
{
  int n,i;
  char m;
  scanf("%d",&n);
  for(i = n-1;i >= 0; i--)
  {
   scanf("%s",word[i]);
   getchar();
  }
  pb(word[n-1],n-1,0);
 return 0;
}


int main()
{
	int i=0,j,begin,end;
	char a[10000],b[10];
	gets(b);
	gets(a);
	while(a[i]){
		begin=i;
		for(j=0;j<80&&a[i];j++)
			i++;
		if(a[i]==0){
			end=i-1;
			i--;
		}
		else{
			while(a[i]!=' ')
					i--;
			end=i-1;
		}
		while(begin<=end){
			printf("%c",a[begin]);
			begin++;
		}
		printf("\n");
		i++;
	}
	return 0;
}


/*
 * WenziPaiban.cpp
 *
 *  Created on: 2012-12-18
 *      Author: ThinkPad
 */
int main()
{
    int n,i,count=0;
    cin>>n;
    char a[n][40];
    for(i=0;i<n;i++)
    	cin>>*(a+i);
    for(i=0;i<n;i++)
    {
    	count=count+strlen(*(a+i))+1;

    	if(count<=80&&count+strlen(*(a+i+1))<=80&&i<n-1)cout<<a[i]<<" ";
    	if(count==81||count+strlen(*(a+i+1))>80||i==n-1)
    	{
    		cout<<*(a+i);
    		count=0;
    		cout<<endl;
    	}
    }

	return 0;

}


int main()
{
	char word[500][40];
	int n,i,l[500],length=80;
	cin>>n;
	for(i=0;i<n;i++)
	{
		cin>>word[i];
		l[i]=strlen(word[i]);
	}
	cout<<word[0];
	length=length-l[0];
	for(i=1;i<n;i++)
	{
		if(l[i]<length)
		{
			cout<<" "<<word[i];
			length=length-l[i]-1;
		}
		else
		{
			cout<<endl;
			length=80;
			cout<<word[i];
			length=length-l[i];
		}
	}
	return 0;
}


struct words
{
     int len;
     char word[20];
};
int main()
{
   int n,i,size,count=0;;
   struct words *a;
   scanf("%d",&n);
   a=(struct words *)malloc(sizeof(struct words)*n);
   for (i=0;i<n;i++)
   {
       size=0;
       scanf("%s",&(a+i)->word);
       for (size=0;(a+i)->word[size]!='\0';size++);
       (a+i)->len=size;
    }
    count=0;
    for (i=0;i<n;i++)
     {
         if (count+(a+i)->len+1>80)
         {
             printf("\n");
             count=0;
             i--;
         }
         else
         {
            if (count==0)
            {
                printf("%s",(a+i)->word);
                count=count+(a+i)->len;
            }
            else
            {
                printf(" %s",(a+i)->word);
                count=count+(a+i)->len+1;
            }
         }
    }
}


int main()
{
	int a ;
	int newline=1;
	int sum = 0;
	char word[80]={0};
	cin >> a;
	memset(word,0,sizeof(word));
	scanf("%s",word);
	cout << word;
	sum = strlen(word);
	while ( a > 1 )
	{
		memset(word,0,sizeof(word));
		scanf("%s",word);
		sum+=strlen(word)+1;
		if(sum <= 80)
		{
			cout <<' '<< word;//<<"sum="<<sum<<endl;

		}
		else
		{
			cout << endl << word;
			sum = strlen(word);
		}
		a--;
	}
		return 0;
}


int main(int argc, char* argv[])
{int n;
scanf("%d",&n);
int i;
int k=0,m=0;
char s[45];
int len;
for(i=0;i<n;i++)
{
	scanf("%s",s);
	len=strlen(s);
	k=k+len;
	m++;
	if(m==1)
	{printf("%s",s);}
	else
	{
	if((k+m-1)<=80)
	{ printf(" ");
	printf("%s",s);
	}
	else
	{printf("\n");
	printf("%s",s);
	k=len;
	m=1;}
	}
}
return 0;
}


int main()
{
	int n, i;
	cin >> n;
	char word[1000][41];
	int temp = 0;
	for(i = 0; i < n; i++)
	{
		cin >> word[i];
	}
	for(i = 0; i < n - 1; i++)
	{
		if(temp + strlen(word[i]) + strlen(word[i + 1]) + 1 <= 80)
		{
			cout << word[i] << ' ';
			temp = temp + strlen(word[i]) + 1;
		}
		else
		{
			cout << word[i] << endl;
			temp = 0;
		}
	}
	cout << word[n - 1];
	return 0;
}


/*
 *  Name:homework.cpp
 *  Created on: 2012-12-10
 *  Author: Meng Li
 *  Function:????
 */

int main(){                            //???
	int n, i;
	cin >> n;
	char *start;
	char *temp;
	temp=start;
	for (i=0;i<n;i++){
		char word[40];
		cin >> word;
		int length=strlen(word);
		if (temp-start+length<80){
			if (temp-start!=0){
				cout << ' ';
				temp++;
			}
			cout << word;
			temp=temp+length;
		}
		else{
			start=temp;
			cout << endl;
			cout << word;
			temp=temp+length;
		}
	}
	return 0;
}


/*
 * qimo_2.cpp
 * Name:????
 *  Created on: 2011-1-9
 *      Author: Wang Ju
 */

int main() {
	int l = 0, n;
	char *p=NULL;
	char s[2000], a[10];
	cin >> n;
	cin.getline(a, 10);
	l = 0;
	cin >> s;
	p = s;
	cout << p;
	l = strlen(s);
	while (n > 1) {
		cin >> s;
		l = l + strlen(s);
		p = s;
		if (l == 80) {
			cout << "\n" << p;
			l = strlen(s);
		} else {
			if (l < 80) {
				cout << " " << p;
				l++;
			} else if (l > 80) {
				cout << "\n" << p;
				l = strlen(s);
			}
		}
		n--;
	}
	return 0;
}


void main()
{
	char s[1000][40];
	int n,len=0,i;
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%s",s[i]);
	len=strlen(s[0]);
	for(i=0;i<n-1;i++)
	{
		len=len+strlen(s[i+1])+1;
		if(len>80)
		{
			len=strlen(s[i+1]);
			printf("%s",s[i]);
			printf("\n");
		}
		else
			printf("%s ",s[i]);
	}
	printf("%s",s[n-1]);
}


struct word
{
	char vol[40];
	int len;
	struct word * next;
};
struct word * create(int n)
{
	struct word *p1,*p2,*head;
	int i;
	for(i=0;i<n;i++)
	{
		p1=(struct word *)malloc(sizeof(struct word));
		scanf("%s",&p1->vol);
		p1->len=strlen(p1->vol)+1;
		if(i==0)
		{
			head=p1;
			p2=p1;
		}
		else
		{
			p2->next=p1;
			p2=p1;
		}
	}
	p1->next=NULL;
	return head;
}
void print(struct word * head,int n)
{
	struct word * pa;
	int count=0;
	pa=head;
	while(n)
	{
		if(count==0)
		{
			printf("%s",pa->vol);
			count+=pa->len;
			pa=pa->next;
			if(pa)
			count+=pa->len;
		}
		else if(count<=81&&count!=0)
		{
			printf(" %s",pa->vol);
			pa=pa->next;
			if(pa)
			count+=pa->len;
		}
		else if(count>81)
		{
			printf("\n%s",pa->vol);
			count=pa->len;
			pa=pa->next;
			if(pa)
			count+=pa->len;
		}
		n--;
	}
}
int main()
{
	int n;
	struct word * head;
	scanf("%d",&n);
	head=create(n);
	print(head,n);
	return 0;
}


int main()
{
	char a[1000][42];
	int n,len[1000],sum=0;
	cin>>n;
	int i;
	for(i=0;i<n;i++)
	{
		cin>>a[i];
		len[i]=strlen(a[i]);
	}
	for(i=0;i<n;i++)
	{
		if(sum+len[i]<=80)
		{
			cout<<a[i];
			sum+=len[i];
			if(sum+1+len[i+1]<=80)
			{
				if(i!=n-1)
				{
				cout<<' ';
				sum++;
				}
			}
			else
			{
				cout<<endl;
				sum=0;
			}
		}
	}
	cout<<endl;
		return 0;
}


int main(){
	int N,number=0;
	cin>>N;
	const int n=N;
	char a[n][50];
	for(int i=0;i<=n-1;++i)
		cin>>*(a+i);
	for(int i=0;i<=n-1;++i){
		if(number+strlen(*(a+i))<=80){
			if(i==0) cout<<*(a+i);
			if(i!=0) cout<<' '<<*(a+i);
			number+=1+strlen(*(a+i));
		}
		else {
			number=0;
			cout<<endl;
			cout<<*(a+i);
			number+=1+strlen(*(a+i));
		}
	}
	return 0;
}


int main()
{
	int n ;
	cin >> n ;
	char paper[500][50] ;
	for ( int i = 0 ; i < n ; i++ )
		cin >> * ( paper + i ) ;
	int l = 81 ;
	for ( int i = 0 ; i < n ; i++ )
	{
		if ( l + strlen( * ( paper + i ) ) + 1 <= 80 )//???????
		{
			cout << ' ' << * ( paper + i ) ;
			l = l + strlen( * ( paper + i ) ) + 1 ;
		}
		else//???????
		{
			cout << endl ;
			cout << * ( paper + i ) ;
			l = strlen( * ( paper + i ) ) ;
		}
	}

	return 0 ;
}
// ( > w < ) finished~


char word[1000][41];
int n;

int main()
{
	cin >>n;
	for(int i = 0;i < n; i ++)
		cin >> word[i];
	int count = 0;
	int p = 0;

	while(p < n)
	{
		int len = strlen(word[p]);
		if(count == 0)
		{
			printf("%s", word[p]);
			p ++;
			count += len;
		}
		else if(len + 1 + count <= 80)
		{
			printf(" %s", word[p]);
			p ++;
			count += len + 1;
		}
		else if(len + 1 + count > 80)
		{
			printf("\n");
			count = 0;
		}
		else
			printf("ERROR!-----------------------------------");
	}
	return 0;
}


int main()
{
	int n;
	struct W{
		char word[100];
		int len;
	}w[520];
	int i,m,j;
	scanf("%d",&n);
	m=0;
	for (i=0;i<n;i++)
	{

		scanf("%s",w[i].word);
		w[i].len=0;
		for (j=0;w[i].word[j]!='\0';j++)
		{
			w[i].len++;
		}

	}
	for (i=0;i<n;i++)
	{
		m=m+w[i].len+1;
		if (i==n-1){
			if (m<=81)
				printf("%s",w[i].word);
			else {
				printf("\n");
				printf("%s",w[i].word);
			}
			}
	else if (m<80 && m+w[i+1].len<81)
		printf("%s ",w[i].word);
	else if (m>81)
		{
			printf("\n");
			printf("%s ",w[i].word);
			m=w[i].len+1;
		}
	else
	{
		printf("%s\n",w[i].word);
		m=0;
	}
	}
	return 0;
}


int main()
{
    int l=0,i,n;
    char word[1500][50];
    cin>>n;
    for(i=0;i<n;i++)
    	cin>>word[i];
    for(i=0;i<n-1;i++)
    {
    	if(l+strlen(word[i])==80)
    	{
    		l=0;
    		cout<<word[i]<<endl;
    	}
    	else if(l+strlen(word[i])<80)
    	{
    		if(l+strlen(word[i])+1+strlen(word[i+1])<=80)
    		{
    			cout<<word[i]<<' ';
    			l=l+strlen(word[i])+1;
    		}
    		else
    		{
    			cout<<word[i]<<endl;
    			l=0;
    		}
    	}
    }
    cout<<word[i];
	return 0;
}


int main(){
	int n,i,len=0;
	scanf("%d",&n);
	char word[1000][40];
	for(i=0;i<n;i++){
		scanf("%s",word[i]);
	}
	for(i=0;i<n;i++){
		len+=strlen(word[i]);
		if(len<=80){
			printf("%s",word[i]);
			len++;
			if(i!=n-1&&len+strlen(word[i+1])<=80){
				printf(" ");
			}
		}else{
			printf("\n%s ",word[i]);
			len=strlen(word[i])+1;
		}
	}
	return 0;
}


char a[10000],tmp[40],cn;
int n,i,j,l=0,tmpl=0;

int main(int argc, char* argv[])
{

	gets(&cn);
	n=atoi (&cn);
	gets(a);
    for (i=0;i<n;i++)
	{
		for (j=0;j<40;j++)
		{
			if (a[j+l]!=' ')
			{
				tmp[j]=a[j+l];
			}
			else
			{
				tmp[j]='\0';
				j=40;
			}
		}
		l+=strlen(tmp)+1;
        l:if (tmpl==0)
		{
			printf ("%s",tmp);
			tmpl+=strlen(tmp)+1;
		}
        else if ((strlen(tmp)+tmpl)<=80)
		{
			printf (" %s",tmp);
  		    tmpl+=strlen(tmp)+1;
		}
		else if ((strlen(tmp)+tmpl)>80)
		{
			printf ("\n");
			tmpl=0;
			goto l;
		}
        //printf ("%d",tmpl);
	}
	return 0;
}


int main()
{
	int i,n,count = 0;
	char word[1000][40];
	cin >> n;
	for(i = 0 ; i < n ; i++)
	{
		cin >> word[i];
	}
	cout << word[0];
	count = count + strlen(word[0]) + 1;
	for(i = 1 ; i < n; i++)
	{
		if(count + strlen(word[i]) > 80)
		{
			cout << endl;
			count = strlen(word[i]) + 1;
			cout << word[i];
		}
		else
		{
			cout << " " << word[i];
			count = count + strlen(word[i]) + 1;
		}
	}
	return 0;
}


int main()
{
	int n, counter = 0,len;
	char a[300][50];
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
	}
	for (int i = 0; i < n ; i++)
	{
		if (counter == 0)
		{
			cout << *(a + i);
			counter += strlen(*(a + i));
		}
		else if (counter + strlen (*(a + i)) + 1 < 80)
		{
			cout << " " << *(a + i);
			counter += strlen(*(a + i)) + 1;
		}
		else if (counter + strlen (*(a + i)) + 1== 80)
		{
			cout << " " << *(a + i) << endl;
			counter =0;
		}
		else
		{
			cout << endl << *(a + i);
			counter = strlen (*(a + i));
		}
	}

	return 0;
}


int main(int argc,char*argv[])
{
	int n,i,m=0,t=0;
	char word[100];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s",word);
		t+=strlen(word);
		m++;
		if(m==1){
			printf("%s",word);
		}else{
			if((t+m-1)<=80){
				printf(" ");
				printf("%s",word);
			}else{
				printf("\n");
				printf("%s",word);
				m=1;
				t=strlen(word);
			}
		}
	}
	return 0;
}


int main()
{
	char s[100];
	int n;
	cin>>n;
	int t=0;
	for (int i=0;i<n;i++)
	{
		cin>>s;
		if (t==0)
		{
			printf("%s",s);
			t+=strlen(s);
		}
		else
		{
			t+=strlen(s)+1;
			if (t<=80)
			{
				printf(" %s",s);
			}
			else
			{
				printf("\n%s",s);
				t=strlen(s);
			}
		}
	}

	return 0;
}


int main()
{
	int i , n , j , sum = 0 , len , sum1 ;
	char before[500][40] , c , *p ;
	cin >> n ;
	for ( i = 0 ; i < n ; i++ )
	{
		j = 0 ;
		p = *( before + i ) ;
		while ( 1 )
		{
			c = cin.get() ;
			if ( c == ' ' || c == '\n' )
				continue ;
			else
				break ;
		}
		*p = c ;
		while ( 1 )
		{
			c = cin.get() ;
			if ( c == ' ' || c == '\n' )
				break ;
			else
				*++p = c ;
		}
		*++p = '\0' ;
	}
	/*	for ( i = 0 ; i < n ; i++ )
	{
		cout << before[i] << " " ;
	}*/
	for ( i = 0 ; i < n ; i++ )
	{
		len = strlen( before[i] ) ;
		sum = sum + len ;
		sum1 = sum + 1 + strlen( before[i+1] ) ;
		if ( sum > 80 )
		{
			sum = len ;
			sum1 = sum + 1 + strlen( before[i+1] ) ;
			cout << endl ;
		}
		cout << before[i] ;
		if ( i < n - 1 &&  sum1 <= 80 )
		{
			cout << " " ;
			sum++ ;
		}
		else
			sum++ ;
	}
	return 0 ;
}


int main()
{
	char word[50];
	int count=0;
	int n;
	cin>>n;
	scanf("%s", word);
	count = strlen(word);
	cout<<word;
	for(int i=1;i<n;i++)
	{
		scanf("%s", word);
		if(count+strlen(word)+1<=80)
		{
			count=count+strlen(word)+1;
			cout<<" "<<word;
		}
		else
		{
			cout<<endl;
			cout<<word;
			count = strlen(word);
		}
	}
	return 0;

}


int main()
{
	int n;
	cin>>n;
	char ch[300][50];
	int lengthch[300];
	for (int i=0;i<n;i++)
	{
		cin>>ch[i];
	    lengthch[i]=strlen(ch[i]);
	}
	int num=80;
	for (int i=0;i<n;i++)
	{
		if (i==n-1) cout<<ch[i];
		else {
		if (num-lengthch[i]-lengthch[i+1]>0)
		{cout<<ch[i]<<' ';num=num-lengthch[i]-1;}
		else
		{cout<<ch[i]<<endl;num=80;}}
	}
	return 0;
}


int main(){
	int n,i,j,sum;
	char word[40];
	scanf("%d\n",&n);
	scanf("%s",word);
	printf("%s",word);
	sum=strlen(word);
	for(i=1;i<n;i++){
		for(j=0;j<40;j++){
			word[j]='\0';
		}
        scanf("%s",word);
		if(sum+strlen(word)+1<=80){
			printf(" %s",word);
			sum=sum+strlen(word)+1;
		}else{
			printf("\n%s",word);
			sum=strlen(word);
		}
	}
	return 0;
}


int main()
{
	char words[10000][41];
	char *p;
	int i,n,l=0;
	int len[10000];
	cin>>n;
	for(i=0;i<n;i++)
	{
		cin>>words[i];
	}

	for(i=0;i<n;i++)
	{
		len[i]=strlen(words[i]);
	}

	for(i=0;i<n;i++)
	{
		p=words[i];
		if(l+len[i]+1<=80)
		{
			if(i!=0)
			{
				cout<<" "<<p;
			l+=len[i]+1;
			}
			else {
				cout<<p;

			l+=len[i];
			}

			continue;
		}

		else {

			cout<<endl;
			cout<<p;
			l=0;
			l+=len[i];
			continue;
		}
	}

	return 0;
}


int main()
{
	int n,i,l,L=0;
	char word[25];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s",word);
		l=strlen(word);
		L+=(l+1);
		if(i==0)
			printf("%s",word);
		else
		{
			if(L>81)
				L=l+1;
			if(L!=(l+1))
				printf(" %s",word);
			else
				printf("\n%s",word);
		}
	}
	return 0;
}


int main()
{
	char word[1000][80];
	int i,n;
	int l1,l2,aa=0;
	cin>>n;
	for (i=0;i<=n-1;i++)
	{
		cin>>word[i];
	}
	i=0;
	while (i!=n-1)
	{
		l1=strlen(word[i]);
		l2=strlen(word[i+1]);
		if ((aa+l1+l2+1>80)&&(aa+l1<=80))
		{
			cout<<word[i]<<endl;
			aa=0;
			i++;
		}
		else
		{
			cout<<word[i]<<" ";
			aa=aa+l1+1;
			i++;
		}
	}
	if (aa+l2<=80)
		cout<<word[n-1];
	else
	{
		cout<<endl;
		cout<<word[n-1];
	}
	return 0;
}


int main()
{
    int n, i, j, sum, l;
    char a[41];
    char *p = a;
    cin >> n;
    sum = 0;
    for (i = 1; i <= n; i++)
    {
       cin >> a;
       l = strlen(a);
       if (sum == 0)
       {
            for (j = 0; j <l; j++) cout << *(p+j);
            sum = l;
        }
       else
       if ( sum + l + 1 <= 80)
       {
            cout << ' ' ;
            for (j = 0; j <l; j++) cout << *(p+j);
            sum = sum + l +1;
       }
       else
       {
           sum = l;
           cout << endl;
           for (j = 0; j <l; j++) cout << *(p+j);
       }
    }
    return 0;
}


int main(int argc, char *argv[])
{
    int n,i,sum1=0,len1,len2,count=0;
    char a[500][40];
    scanf("%d",&n);
    for(i=0;i<n;i++){   //??
                     scanf("%s",a[i]);
                     }
    int sum2=strlen(a[0]);

    for(i=0;i<n-1;i++){
                     len1=strlen(a[i]);
                     len2=strlen(a[i+1]);
                     sum1+=len1;
                     sum2+=len2;

                     if(sum2+count+1<=80) {printf("%s ",a[i]);count++;}
                     else if(sum2+count+1>80 && sum1+count<=80)  {
                          printf("%s\n",a[i]);
                          count=sum1=0;
                          sum2=strlen(a[i+1]);
                          }
                     else {
                          printf("\n");
                          count=sum1=0;i--;
                          sum2=strlen(a[i]);

                          }
                          }

    printf("%s\n",a[n-1]);

  return 0;
}


int change1(int n)
{
	return n%10;
}
int change2(int n)
{
	return n%100/10;
}
int change3(int n)
{
	return n /100;
}

int main ()
{

    int n;
	cin>>n;
	char a[20];
	int len,relen=0;
	cin>>a;
	relen+=strlen(a);
	cout<<a;
	for (int i=0;i<n-1;i++)
	{
		cin>>a;
		len=strlen(a);
		if(relen+1+len<=80)
		{
			relen+=1+len;
			cout<<' '<<a;
		}
		else
		{
			cout<<endl;
			relen=strlen(a);
			cout<<a;
		}
	}

	return 0;
}


//??????????????????????
int main()
{
	int number=0;
	char string1[50],string2[50];
	int length1=0,length2=0,length3=0;
	int k=0,m=0,n=0;
	cin>>number;
	gets( string1 );                                                  //????????????

	cin>>string1;                                                     //string1?????
	k=1;                                                              //k?????????
	cout<<string1;
	length1=strlen(string1);
	while ( k<number )
	{
		cin>>string2;
		length2=strlen(string2);
		length1=length1+length2+1;

		if ( length1<=80 )                                            //??????????<=80?????????????
			cout<<" "<<string2;
		else if ( length1>80 )                                        //??????????????80???????????
		{
			cout<<endl;                                               //???
			cout<<string2;
			strcpy(string1,string2);                                  //???????????
			length1=strlen(string1);
		}
		k++;
	}
	return 0;
}


int main ()
{
	int n,i,line = 0,count = 0;
	char ch[45], *p;
	cin >> n;
	for (i = 1; i<= n;i++)
	{
		cin >> ch;
		p = ch;
		while (*p !='\0' )
		{
			p++;
			count++;
		}
		if (line +  count <= 80 && line == 0)
		{
			line = count;
			cout << ch;
			count = 0;
			continue;
		}
		if(line + count  + 1<= 80)
			{
				cout << ' ' << ch;
				line = count +1  + line;
				count = 0;
				continue;
			}
		if (line + count + 1> 80)
		{
			cout << endl;
			cout << ch;
			line =  count;
			count = 0;
		}

	}
	return 0;
}


void main ()
{
	char word[10000][40];
	int i,n,q=0;
	scanf("%d",&n);
	for (i=0;i<n;i++)
	{
		scanf("%s",word[i]);
	}
	for (i=0;i<n;i++)
	{
		if (q!=0)
		{
			q=q+1+strlen(word[i]);
		}
		if (q==0)
		{
			q=q+strlen(word[i]);
		}

		if (q-strlen(word[i])==0)
			printf("%s",word[i]);
	    if (q-strlen(word[i])!=0&&q<=80)
			printf(" %s",word[i]);
		if (q>80)
		{
			printf("\n");
			printf("%s",word[i]);
			q=strlen(word[i]);
		}
	}
}


int main()
{ char *string,a[100]={'\0'};
  int n=0,i=0,sum=0,t=1;
  scanf("%d",&n);
  string=a;
  scanf("%s",string);
  sum=sum+strlen(string);
  for(i=1;i<=n;i++)
  {  printf("%s",string);
	 if(i<n)
	 {scanf("%s",string);}
	 sum=sum+strlen(string)+1;

	  if(sum>80)
	  {sum=strlen(string);printf("\n");t=0;}
      if(i<n&&t!=0)
	  { printf(" ");
	  	  }
	 t=1;

  }

 return(0);
}


int main()
{
	int n=0,i=0,len=0,count=0;
	char word[1000][41];
	cin>>n;
	for(i=0;i<n;i++)
	{
		cin>>word[i];
	}
	for(;count<n;)
	{
		len+=strlen(word[count]);
		cout<<word[count++];
		while(len+strlen(word[count])+1<=80)
		{
			if(count>=n)
				break;
			else
			{
				len+=strlen(word[count])+1;
				cout<<" "<<word[count++];
			}
		}
		len=0;
		cout<<endl;
	}
	cout<<endl;
	return 0;
}


// ????.cpp : Defines the entry point for the console application.
//

int main()
{
	int n, lenth = 0, i, j, flag = 0;
	char a[40], *p = a;
	cin >> n;
	for(i = 0; i < n; i++)
	{
			cin >> a;
			lenth += strlen(a) + 1;
			if((lenth - 1) <= 80)
			{
				if(flag == 1)
					cout << ' ';
				cout << a;
				flag = 1;
			}
			if(lenth - 1 > 80)
			{
				cout << endl;
				lenth = strlen(a) + 1;
				cout << a;
			}
			for(j = 0; j < 40; j++)
				*(p + j) = NULL;          //???????
	}
	return 0;
}


void main(){
  int i, j, n, b, num=0;
  char string[10000][40];
  char c;
  scanf("%d", &n);
  for(i=0;i<n;i++)
	  scanf("%s",string[i]);

  for(i=0;i<n;i++){
	  for(j=0,b=0;(c=string[i][j])!='\0';j++)
		  b++;
	  num=num+b+1;

      if(num<81||num==81){
		  if(i==0)printf("%s", string[0]);
			  else
	    printf(" %s", string[i]);
	  }
	  else if(num>81){
		printf("\n%s", string[i]);
		num=b+1;
	  }
  }
}


int main(){
	char word[42];
	int chars_left,word_length,word_num;

	scanf("%d",&word_num);
	scanf("%s",&word);
	printf("%s",word);
	word_num--;
	word_length=strlen(word);
	chars_left=80-word_length;
	while(word_num!=0){
		scanf("%s",&word);
		word_length=strlen(word);
		if(chars_left<word_length+1){
			printf("\n%s",word);
			chars_left=80-word_length;
		}
		else{
			printf(" %s",word);
			chars_left=chars_left-word_length-1;
		}
        word_num--;
	}
	return 0;
}


main()
{
 int i,n,sum=0;
 char letter[1000][41]={""};
 scanf("%d",&n);
 for(i=0;i<n;i++)
 {
  scanf("%s",(letter+i));
 }
 for(i=0;i<n;i++)
 {
  if(i!=n-1)
  {if(sum==79||((sum+strlen(letter[i]))>80))
  {printf("\n");sum=0;i--;}
  else
  {
   if((sum+strlen(letter[i])+1+strlen(letter[i+1]))>80)
   {sum+=strlen(letter[i]);
   printf("%s",letter[i]);sum++;}
   else{
       sum+=strlen(letter[i]);
   printf("%s ",letter[i]);sum++;
       }
  }}
  else
  printf("%s",letter[i]);
 }
}


int main()
{
char x[500][50]={0};
    int i,j,m,k,total,temp,y[500];
    scanf("%d",&k);
    temp=k;
    for(i=0;i<=k-1;i++)
    scanf("%s",x[i]);
    for(i=0;i<=k-1;i++)
    y[i]=strlen(x[i]);
    for(i=0;;)
    {
                 printf("%s",x[i]);
                 total=y[i];
                 temp--;
                 for(j=i+1;;j++)
                 {
                                total=total+y[j]+1;
                                if(total>80) break;
                                temp--;
                                if(temp==0) break;
                 }
                 if(temp!=0)
                 {
                 for(m=i+1;m<=j-1;m++)
                 printf(" %s",x[m]);
                 printf("\n");
                 i=j;
                 }
                 else
                 {
                      for(m=i+1;m<=k-1;m++)
                      printf(" %s",x[m]);
                      printf("\n");
                      break;
                 }
    }
return 0;
}


int main(int argc, char* argv[])

{
	int n,i,len=0;
	char word[20];
    scanf("%d",&n);
	for(i=0;i<n;i++)
	{
	   scanf("%s", word);
	   len=len+1+strlen(word);
	   if(i==0)
	   {
		   printf("%s",word);

	   }
	   else
	   {
		   if(len<=81)
		   printf(" %s",word);
	        else
			{
		   printf("\n");
		   printf("%s",word);
		   len=strlen(word)+1;
			}
	  }
	}
	return 0;
}


int main()
{
	char word[1000][83];
	int n,i,counter=0;
	cin>>n;
	for(i=0;i<n;i++)
		cin>>word[i];
        char *p,*temp;
	for(i=0;i<n;i++)
	{
                temp=word[i];
		if(counter==0)
		{
                        for(p=temp;p<temp+strlen(word[i]);p++)
                             cout<<*p;
			counter=counter+strlen(word[i]);
		}
		else
		{
			if(counter+strlen(word[i])+1<=80)
			{
				cout<<" ";
                                for(p=temp;p<temp+strlen(word[i]);p++)
                                      cout<<*p;
				counter=counter+strlen(word[i])+1;
			}
			else
			{
				cout<<endl;
				counter=0;
				i--;
			}
		}
	}
	return 0;
}


int main(){
	char word[41];
	int sum=0,n,t;
	cin>>n;
	t=n;
	n--;
	scanf("%s",word);
	cout <<word;
	sum=sum+strlen(word);
	while(n--)
	{
		scanf("%s",word);
		if((sum+strlen(word)+1 <= 80)&&(n!=t)){
			cout<<' ';
			sum++;
		}
		else {
			cout<<'\n';
			sum=0;
		}
		sum=sum+strlen(word);
		cout<<word;
		memset(word,0,sizeof(word));
	}

    return 0;
}


void read_words(char words[][WSIZE], int n)
{
  int i;
  for (i = 0; i < n; i++) {
    scanf("%s", words[i]);
  }
}

int split_lines(char words[][WSIZE], int lines[], int n)
{
  int i = 0;
  int j = 0;
  lines[j] = 0;
  while (i < n) {
    int len = strlen(words[i]);
    while (len <= MAX_LINE) {
      i++;
      if (i < n) {
        len += 1 + strlen(words[i]);
      }
      else break;
    }
    j++;
    lines[j] = i;
  }
  return j;
}

void print_words(char words[][WSIZE], int lines[], int line_num)
{
  int i, e, k;
  for (k = 0; k < line_num; k++) {
    e = lines[k + 1] - 1;
    for (i = lines[k]; i < e; i++) {
      printf("%s ", words[i]);
    }
    printf("%s\n", words[e]);
  }
}

int main()
{
  int n;
  scanf("%d", &n);
  char words[n][WSIZE];
  read_words(words, n);
  int lines[n];
  int line_num = split_lines(words, lines, n);
  print_words(words, lines, line_num);
  return 0;
}


/*
 * m.cpp
 *
 *  Created on: 2013-12-7
 *      Author: de
 */

char *p=NULL;

int t=0,len=0;
void paiban(char *q,int i){
	if(q[i]==' '){q[i]='\n';
      t+=80;
      if(len-t<=80) {
    	  cout<<p;return;}
      else paiban(q+i+1,79);
	}
	else{
		if(q[i+1]==' '){q[i+1]='\n';
		t+=81;
		if(len-t<=80) {
		    	  cout<<p;return;}
		      else paiban(q+i+2,79);
		}
		else{
		i--;
		while(q[i]!=' '){
			i--;
		}
		q[i]='\n';
		i++;
		t+=i;
		if(len-t<=80){cout<<p;
		return;
		}
		else paiban(q+i,79);
		}
	}
}
int main(){
	int n;
   cin>>n;
  char text[42*n];
  p=text;
   char c[1];
   cin.getline(c,1);
   cin.getline(text,42*n); //cout<<"*********************"<<strlen(text);
   len=strlen(text);
   if(len>80){

   paiban(text,79);
   }
   else
   cout<<text<<endl;

	return 0;
}


int main()
{
	char a[1000][40];
	int n,i,j;
	cin>>n;
	for(i=0;i<n;i++)
	{
		cin>>a[i];
	}
	for(i=0;i<n;)
	{
		cout << a[i];
		int la=strlen(a[i]);
		int lc=la;
		for(j=1;j+i<n;j++)
		{
			int lb=strlen(a[i+j]);
			lc+=lb;
			if(lc<80)
			{
				cout <<" "<<a[i+j];
				lc++;
			}
			else
			{
				cout <<endl;
				break;
			}
		}
		i+=j;
	}
	return 0;
}


int main()
{
	int n, count = 0, j = 1, l;
	char a[41];
	char *p = a;
	cin >> n;
	for ( int i = 1; i <= n; i++ )
	{
		cin >> p;
		l = 0;
		for ( *p; *p != '\0'; *p++ )
		{
			l++;
		}
		count = count + l;
		p=a;
		if ( count < 80 && count != l )
		{
			cout << " " << p;
			count++;
		}
		else if ( count < 80 && count == l )
		{
			cout << p;
		}
		else
		{
			cout << endl;
			cout << p;
			count = l;
		}
	}
	return 0;
}


int main ()
{
	int a[1000],i,n,sum=0;
	char word[1000][40]={""};
	scanf("%d",&n);
	for (i=0;i<n;i++)
		scanf("%s",word[i]),
		a[i]=strlen(word[i]);
	for(i=0;i<n-1;i++)
	{	sum=sum+a[i]+1;

	if(sum+a[i+1]<81)
		printf("%s ",word[i]);
	else
		printf("%s\n",word[i]),
		sum=0;
	}
	printf("%s",word[n-1]);
	return 0;
}


int main()
{
    char word[1000][50];
    int sum=0,n,i;
    cin>>n;
    cin.get();
    for(i=0;i<n;i++)
    cin.getline(word[i],50,' ');

    for(i=0;i<n-1;i++)
    {
           sum+=strlen(word[i])+1;
           if(sum+strlen(word[i+1])<=80)
                  cout<<word[i]<<" ";
           else if(sum+strlen(word[i+1])>80)
           {
                 cout<<word[i]<<endl;
                 sum=0;
           }
    }
    cout<<word[n-1]<<endl;

    return 0;
}


int main()
{
	int n, i, count = 0, len,j, flag = 0;
	char word[2000][2000];
	char *p = NULL;
	cin >> n;
	for (i = 0; i < n; i++)
	{
		cin >> word[i];
		len = strlen(word[i]);
		word[i][len] = 0;
	}
	i = 0;
	while(i < n)
	{
		p = word[i];
		j = 0;
		{
			len = 0;
		//	while (*(p+len) != 0) len++;
		len = strlen(word[i]);
		//	cout << count << endl;
		//	cout << len << endl;
			if (len > (80 - count))
			{
				cout << endl;
				while (*p != 0)
				{
					cout << *p;
					p++;
				}

				i++;
				count = len + 1;
			}
			else
			{
				if (! count == 0) 	cout << " ";
				while (*p != 0)
				{
					cout << *p;
					p++;
				}
				count += len;
				count++;
				i++;
			}
		}
	}

	return 0;
}


int main()
{
	char danci[300][40];
	int n,i=0,j=0,k=0;
	cin>>n;
	for(i=0;i<n;i++)
		cin>>danci[i];
	for(i=j;i<n;i++)
	{
		int a=0;
		for(j=i;j<n;j++)
		{
			a=a+strlen(danci[j])+1;
			if(a>81)
				break;
		}
		if(a<=81)
			for(int h=i;h<n;h++)
			{
				if(h==i)
					cout<<danci[h];
				else
					cout<<" "<<danci[h];
			}
		else
		{
			for(int h=i;h<j;h++)
			{
				if(h==i)
					cout<<danci[h];
				else
					cout<<" "<<danci[h];
			}
			cout<<endl;
		}
		i=j-1;

	}
	return 0;

}


char a[10010];
int l, n, i, j;

void biubiu(int ks, int ll)
{
    int k;
    if(ll - ks < 80)
    {
        for(i = ks; i < ll; i++)
            cout << a[i];
        cout << endl;
    }
    else
    {
        if(a[ks + 79] == ' ')
        {
            for(i = ks; i < ks + 79; i++)
            cout << a[i];
            cout << endl;
            biubiu(ks + 80, ll);
        }
        else
        {
            if(a[ks + 80] == ' ')
            {
                for(i = ks; i <= ks + 79; i++)
                cout << a[i];
                cout << endl;
                biubiu(ks + 81, ll);
            }

            else
            {
                for(k = ks + 78; k > ks; k--)
                if(a[k] == ' ')
                    break;
                for(i = ks; i < k; i++)
                cout << a[i];
                cout << endl;
                biubiu(k + 1, ll);
            }

        }
    }

}

int main()
{
    scanf("%d\n", &n);
    gets(a);
    l = strlen(a);
    int ll = l;
    i = l;
    while(a[i] == ' ')
    {
        i --;
        ll --;
    }
    for(i = 0; i < l; i++)
    {
        if(i == 0 && a[i] == ' ')
        {
            for(j = 0; j < l - 1; j++)
                a[j] = a[j + 1];
            i--;
            ll--;
        }
    }
    biubiu(0, ll);
    return 0;
}
/*
84
One sweltering day, I was scooping ice cream into cones and told my four children they could "buy" a cone from me for a hug. Almost immediately, the kids lined up to make their purchases. The three youngest each gave me a quick hug, grabbed their cones and raced back outside. But when my teenage son at the end of the line finally got his turn to "buy" his ice cream, he gave me two hugs. "Keep the changes," he said with a smile.
*/


int main ()
{
	int n ;
	char str[10001][40];
	cin >> n ;cin.get();
	for ( int i = 1 ; i <= n ; i++ )
	{
		cin.getline(str[i],40,' ');
	}
	int sum = 0 ;
	for ( int i = 1 ;i <= n ; i ++ )
	{
		sum += strlen(str[i]);
		if ( sum <= 80 )
		{
			if ( sum != strlen(str[i]) )
			{
				cout << " " ;
			}
			else
			{
				sum = sum ;
			}
			for ( int j = 0 ; j < strlen(str[i]); j ++ )
			{
				cout << *(str[i]+j);
			}
			sum ++ ;
		}
		else
		{
			cout << endl ;
			sum = 0 ;
			i -- ;
		}
	}
	return 0 ;
}


int main()
{
  int n,i,m=0;
  char word[1000][20];
  scanf("%d",&n);
  for(i=0;i<=n-1;i++)
  {
	  scanf("%s",word[i]);
  }
  for(i=0;i<=n-1;i++)
  {
	  if(m<=80-strlen(word[i]))
	  {
		  printf("%s",word[i]);
		  if(m<=79-strlen(word[i])-strlen(word[i+1])&&i<n-1)
		  printf(" ");
          m+=strlen(word[i])+1;
	  }
      else
	  {
		  i=i-1;
		  printf("\n");
		  m=0;
	  }

  }
  return 0;
}


int main()
{
    int i,n,sum=0,length[1000];
    char word[1000][50];
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
                    scanf("%s",word[i]);
                    length[i]=strlen(word[i]);
    }
    for(i=0;i<n-1;i++)
    {
                    if(sum+length[i]<=80)
                    {
                                         if(sum+length[i]+length[i+1]+1<=80)
                                         {
                                                                            printf("%s ",word[i]);
                                                                            sum+=length[i]+1;
                                         }
                                         else
                                         {
                                             printf("%s\n", word[i]);
                                             sum=0;
                                         }

                    }

    }
    printf("%s", word[n-1]);
    return 0;
}


void main()
{
	int i,n,sum=0,m;
	char word[40];
	scanf("%d",&n);
	printf("\n");
	for(i=1;i<=n;i++)
	{
		scanf("%s",word);
		m=strlen(word)+1;
		sum=sum+m;
		if((sum>81)||(i==1))
		{
			printf("\n");
			sum=m;
			printf("%s",word);
		}
		else
		    printf(" %s",word);
	}
	printf("\n");
}


/*
 * Typesetting.cpp
 *
 *  Created on: 2013-12-5
 *      Author: KEVIN
 */

int main()
{
	int n;
	cin>>n;
	char line[81];
	char* p=line;
	memset(line,'\0',81);
	while(n--)
	{
		char word[41];
		cin>>word;
		int len=strlen(word);
		if(strlen(line)+len>80)
		{
			*(p-1)='\0';//?line???????'\0'
			cout<<line<<endl;
			memset(line,'\0',81);
			p=line;
		}
		memcpy(p,word,len);
		p+=len;
		*p++=' ';
	}
	if(strlen(line)>0)
	{
		*(p-1)='\0';
		cout<<line;
	}
	return 0;
}


int n;//?????
char words[1000][100];//?????????
int wordlen[1000],longsum=0;//?????????
void out(int location)
{
	int i,j;
	for(i=location;i<n;i++)
	{
		longsum=longsum+wordlen[i]+1;
		if(longsum-1>80)
		{
			for(j=location;j<=i-2;j++)
				cout<<words[j]<<' ';
			cout<<words[i-1]<<endl;
			break;
		}
		if(longsum-1==80)
		{
			for(j=location;j<=i-1;j++)
				cout<<words[j]<<' ';
			cout<<words[i]<<endl;
			i++;
			break;
		}
		if(i==n-1)
		{
			for(j=location;j<n-1;j++)
				cout<<words[j]<<' ';
			cout<<words[n-1]<<endl;
			return;
		}
	}
	longsum=0;
	location=i;
	out(location);
}
int main()
{
	int i,j;//????
	cin>>n;
	for(i=0;i<n;i++)
	{
		cin>>words[i];
		wordlen[i]=strlen(words[i]);
	}
	out(0);
	return 0;
}


int main()
{
	char words[400][50];
	int n;
	cin >> n;
	int i;
	int counter = 0;
	for( i = 0 ; i <= n - 1 ; i ++ )
		cin >> words[i];
	char (*p)[50];
	for( p = words ; p <= words + n - 2 ; p ++ )
	{
		counter = counter + strlen( * p );
		if( counter < 80 )
		{
			if( counter + 1 + strlen( * ( p + 1 ) ) <= 80 )
			{
				cout << *p << " ";
				counter ++;
			}
			else
			{
				cout << *p << endl;
				counter = 0;
			}
		}
		else if( counter == 80 )
		{
			cout << *p << endl;
			counter = 0;
		}
		else
		{
			cout << endl << *p ;
			counter = strlen( *p );

		}
	}
	counter = counter + strlen( * p );
	if( counter <= 80)
		cout << *p;
	else
		cout << endl << *p;

	return 0;
}


main()
{
    int n;
    scanf("%d",&n);
    char word[n][41];
    for(int i=0;i<n;i++)
    {
        scanf("%s",word[i]);
    }
    int l=0;
    for(int i=0;i<n;i++)
    {
        if(l==0)
        {
            printf("%s",word[i]);
            l+=strlen(word[i]);
        }
        else
        {
            l+=strlen(word[i])+1;
            if(l<81)
                printf(" %s",word[i]);
            else
            {
                printf("\n");
                l=0;
                i--;
            }
        }
    }
}


int main()
{
	int n; cin >> n;
	int t = 2;
	char initial[40];
	cin >> initial;
	cout << initial;
	int count = strlen(initial);
	int mark = 1;
	while (t <= n)
	{
		char word[41];
		cin >> word;
		int lenth = strlen(word);
		count+= lenth;
		if (count + t - mark> 80)
		{
			/*for (int i = 0; i < lenth; i++)
			{
				temp[i] = word[i];
			}
			temp[lenth] = '\0';*/
			cout << endl;
			cout << word;
			count = lenth;
			mark = t;
		}
		else
			cout << " " << word;
		t++;
	}
	cout << endl;
	return 0;
}


/*
 * wenzi.cpp
 *
 *  Created on: 2012-12-7
 *      Author: ada
 */
int main()
{
	int n ;
	cin>>n;
	char a[1000][41];
	for(int i = 0 ; i <= n ; i++)
	{
		cin>>a[i];
	}
	int len = (int)strlen(a[0]) ;

	cout<<a[0];
	 for(int i  = 1 ; i < n ; i++)
	 {
		 len = len + (int)strlen(a[i])+1;
		 if(len<=80)
		 {

			 cout<<" "<<a[i];
		 }
		 else
		 {
			 cout<<endl<<endl<<a[i];
			 len = (int)strlen(a[i]);

		 }
	 }
	 return 0 ;
}


int main(){
	int i,n,len;
	int sum=0;
	char dw[1000][41];
	scanf("%d",&n);
    for(i=0;i<n;i++){
		scanf("%s",dw[i]);
		len=strlen(dw[i]);

		if(sum+len+1>80){
			printf("\n");
			sum=0;
		}else{
			if(i>0){
			   printf(" ");
			   sum++;
			}
		}
		printf("%s",dw[i]);
		sum+=len;
	}
	return 0;
}


int main(){
    int n,i,x,linelen=0;
    char words[40];
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
            scanf("%s",words);
            if (linelen==0)
            x=strlen(words);
            else
            x=strlen(words)+1;
            if(linelen==0)
            {
                printf("%s",words);
                linelen+=x;
            }
            else if((linelen+x)<80)
            {
                printf(" %s",words);
                linelen+=x;
            }
            else if((linelen+x)==80)
            {
                printf(" %s\n",words);
                linelen=0;
            }
            else if((linelen+x)>80)
            {
                 printf("\n%s",words);
                 linelen=x;
                 linelen--;
            }
    }

    return 0;
}


main()
{
    char word[41];
    int sum=0,n,t;
    scanf("%d",&n);
    t=n;
    while(n>0)
    {
        scanf("%s",word);
        if((sum+strlen(word)+1<=80)&&n!=t)
        {
            printf(" ");
            sum++;
        }
        else
        {
            printf("\n");sum=0;
        }
        sum=sum+strlen(word);
        printf("%s",word);
        memset(word,0,sizeof(word));
        n--;
    }
}


int main()
{
	int n;
	char word[40]={0};
	cin>>n;cin.get();
	int end=0;
	for(int i=1;i<=n;i++)
	{
	    scanf("%s",word);
	    int l=strlen(word);
		if(end+l+1>80)
		{
			cout<<endl;
			cout<<word;
			end=l;
		}
		else
		{
			if(i>1)
			{
			    cout<<' ';
			    end++;
			}
			cout<<word;
			end=end+l;
		}
	}
	return 0;
}


int main()
{
	char a[50];
	char *p = NULL;
	int i,len = 0,l,n,num = 0;
	p = a;
	cin >> n;
	while(cin >> a)
	{

		l = strlen(a);
		num ++;
		len += l;
		if ( len > 80 )
		{
			cout << endl;
			len = l;
			num = 1;
		}
		else if( num != 1 ) cout <<' ';
		for ( i = 0; i < l; i ++ )
		{
			cout<<*(p + i);
		}
		len ++;
	}
	return 0;
}


int main()
{
	int n, i, sum = 0, len;
	char c[10000][41];
	cin >> n;
	for(i = 0;i < n;i++)
		cin >> c[i];
	 for(i = 0;i < n;i++)
	 {
		 len = strlen(c[i]);
		 if(sum + len > 80)
		 {
			 sum = 0;
			// cout << endl;
			 cout << c[i] <<' ';
		 }
		 else if(sum + len < 80)
		 {
			 sum = sum + len + 1;
			 len = strlen(c[i+1]);
			 if(sum + len > 80)
			 {
				 sum = 0;
				 cout << c[i];
				 cout << endl;
			 }
			 else if(sum + len < 80)
			 {
				 if(i == n-1)  cout << c[i];
				 else cout <<c[i] <<' ';
			 }
		 }
		 else if(sum + len == 80)
		 {
			 sum = 0;
			 cout << c[i-1] <<' '<< c[i] << endl;
		 }
	 }
	 return 0;
}


int main()
{
	int n=0,line=80;
	cin>>n;
	getchar();
	while(n>0)
	{
		int changdu=1;
		char a[50]={'\0'};
		char *p=NULL;
		p=a;
		char d='\n';
		while(d=='\n')d=getchar();
		*p=d;
		while(true)
		{
			d=getchar();
			if(d==' '||d=='\n')break;
			changdu++;
			p++;
			*p=d;
		}
		p=a;
		int i;
		//for(i=1;i<=changdu;i++){cout<<*p;p++;}
		//cout<<endl<<changdu<<endl;

		if(changdu<line)
		{
			if(line!=80){cout<<" ";line--;}
			for(i=1;i<=changdu;i++){cout<<*p;p++;}
			line=line-changdu;
			if(line==0)
			{
				cout<<endl;
				line=80;
			}

		}
		else
		{
			cout<<endl;
			for(i=1;i<=changdu;i++){cout<<*p;p++;}
			line=80-changdu;

		}

	n--;
	}

	return 0;
}


int main()
{
    char str[400][45];
    int len[400];
    int *p;
    int k=0,sum=0;
    p=len;
    int n,i,j;
    cin>>n;
    for(i=0;i<=n-1;i++)
      cin>>str[i];

    for(i=0;i<=n-1;i++)
    {
      len[i]=strlen(str[i]);
    }
    i=0;sum=0;k=0;

    while(i<=n-1)
    {
       if(k==0)
      {
       cout<<str[i];
       k++;
       sum=len[i]+sum;
       i++;
       }
      else
      {
        if(sum+1+len[i]<=80)
        {
        cout<<" "<<str[i];
        k++;
        sum+=(1+len[i]);
        i++;
        }
        else
        {
         cout<<endl;
         k=0;sum=0;
        }
      }

    }

return 0;
}


int main()
{
	int n=0;
	cin>>n;
	char b[2];
	cin.getline(b,2);
	char a[5000];
	cin.getline(a,5000);
	char *p=NULL,*q=NULL;
	int sum=0,single=0;//????????????
	for(p=a;*p!=' ';p++)
		cout<<*p;
	sum=p-a;
	for(int i=1;i<n;i++){
		single=0;
		q=p+1;
		for(p++;*p!=' '&&*p!='\0';p++)
			single++;
		sum+=single+1;
		if(sum<=80)cout<<' ';
		else {
			cout<<endl;
			sum=single;
		}
		if(i<n-1){
			for(;*q!=' ';q++)
				cout<<*q;
		}
		else {
			for(;*q!='\0';q++)
				cout<<*q;
		}
	}
	return 0;
}


int main(int argc, char *argv[])
{
  char a[50];
  int n,i,j,line,l;
  scanf("%d",&n);
  scanf("%s",a);
  printf("%s",a);
  line=strlen(a);
  for(i=2;i<=n;i++)
  {
      scanf("%s",a);
      line+=strlen(a)+1;
      if(line<=80)
      {
          printf(" %s",a);
      }
      else
      {
          printf("\n%s",a);
          line=strlen(a);
      }
  }

  return 0;
}


int main()
{
	char a[100000];
	int n=0,j=0,i=0,sum=0,j1=0,j2=0;
	cin>>n;
	//cout<<n;
	cin.get();
	cin.getline(a,100000);
	//cout<<'f';
	while(a[i]!='\0')
	{i++;
		sum++;}
	while(sum-j>80)
	{j1=j;
	j=j+80;
	j2=j;

		while(a[j]!=' ')
			j--;
		if(j==j2)
			for(i=j1;i<j;i++)
				if(i==j-1)
					cout<<a[i]<<endl;
				else
				cout<<a[i];
		else
		for(i=j1;i<j;i++)
			if(i==j-1)
				cout<<a[i]<<endl<<endl;
			else
				cout<<a[i];
		j=j+1;
	}
	for(i=j;i<sum;i++)
		if(i==sum-1)
			cout<<a[i];
		else
		cout<<a[i];
	return 0;
}


char a[100000][50];
int main()
{int n=0;
cin>>n;
for (int i=1;i<=n;i++)scanf("%s", a[i]);
int s=0;

for (int i=1;i<=n;i++)
 {

      if (s+strlen(a[i])<=80)
       {
        if (s+strlen(a[i])+strlen(a[i+1])+1<=80){cout<<a[i];if (i!=n)cout<<' ';s+=strlen(a[i]);s++;}
        else if (s+strlen(a[i])+strlen(a[i+1])+1>80){cout<<a[i]<<endl;s=0;}
       }
      else if (s+strlen(a[i])>80)
      {cout<<endl<<a[i]<<' ';s=strlen(a[i]);s++;}

 }
return 0;
}


int main()
{
	int n, i, len, p = 0;
	cin >> n;
	char str[40];
	for (i = 0; i < n; i++)
	{
		cin >> str;
		len = strlen(str);
		if (p + len < 80)
		{
			if (p != 0)
			{
				cout << " ";
				p++;
			}
			p = p + len;
		}
		else
		{
			p = len;
			cout << endl;
		}
		cout << str;
	}
	return 0;
}


int main()
{
	char words[2000][20],(*p)[20],*s,sumlen=0,len;
	int num;
	cin>>num;
	for(p=words;p-words<num;p++)
	{
		cin>>*p;
	}
	for(p=words;p-words<num;p++)
	{
		for(s=*p;*s!=0;s++);
		len=s-*p;
		if(sumlen+len+1<80)
		{
			if(sumlen==0)
			{
				cout<<endl;
				cout<<*p;
				sumlen+=len;
			}
			else
			{
				cout<<" "<<*p;
				sumlen+=(len+1);
			}
		}
		else
		{
			if(sumlen+len+1==80)
			{
				sumlen=0;
				cout<<" "<<*p;
			}
			else
			{
				sumlen=0;
				p--;
			}
		}
	}
	return 0;
}


int n,len,tot;
char a[1000][50];
void fill(int p);
int main()
{
	int i,j;
	scanf("%d",&n);
	for (i=0;i<n;i++)
		scanf("%s",&a[i]);
	printf("%s",a[0]);
	tot=strlen(a[0]);
	for (i=1;i<n;i++)
	{
		len=strlen(a[i]);
	    if (tot+len+1<=80)
		{
			printf(" %s",a[i]);
			tot+=len+1;
		}
		else
		{
			printf("\n");
			printf("%s",a[i]);
			tot=len;
		}
	}
}


//
//  main.cpp
//  ????
//
//  Created by mac on 12-12-12.
//  Copyright (c) 2012? mac. All rights reserved.
//

int main(){
    int n,num;
    char str[1000][1000];
    cin>>n;
    char (*p)[1000];
    for(int i=0;i<n;i++)
    cin>>str[i];
    cout<<*str;
    num=strlen(*str);
    for(p=str+1;p<n+str;p++){
        num=num+strlen(*p);
        if(num>=80){
            cout<<endl;
            num=strlen(*p);
            cout<<*p;
        }
        else{
            cout<<" "<<*p;
            num=num+1;}
    }
    return 0;
}


int main() {
	char str[1000][45];
	int n, sum = 0;
	cin >> n;
	for ( int i = 1; i <= n; i ++ ) {
		cin >> str[i];
	}
	for ( int i = 1; i <= n; i ++ ) {
		if ( sum == 0 ) {
			cout << str[i];
			sum += strlen( str[i] );
		}
		else if ( sum + strlen( str[i] ) + 1 <= 80 ) {
			cout << " " << str[i];
			sum += strlen( str[i] ) + 1;
		}
		else {
			cout << endl;
			sum = 0;
			i = i - 1;
		}
	}
	return 0;
}


int main()
{
	char str[2000][50];
	int n,i,j,sum=0,geshu,ji=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%s",str[i]);
	for(i=0;i<n;i++)
	{
		j=0;
		geshu=0;
		while(str[i][j]!='\0')
		{
			geshu++;
			j++;
		}
		if(ji==0)
		{
			printf("%s",str[i]);
		    sum=sum+geshu;
		}
		else
		{
			sum=sum+geshu+1;
			if(sum<=80)
				printf(" %s",str[i]);
			else
			{
				printf("\n%s",str[i]);
				sum=geshu;
			}
		}
		ji=1;
	}

	return 0;
}


int main()
{
	int t = 0, n, flag[10000] = {0};
	char word[10000][40];
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> word[i];
	cout << word[0];
	t = strlen(word[0]);
	for (int i = 1; i < n; i++)
	{
		int l = strlen(word[i]) + 1;
		t = t + l;
		if (t < 81)
			cout << " " << word[i];
		if (t >= 81)
		{
			cout << endl << word[i];
			t = strlen(word[i]);
		}
	}
	return 0;
}


int main(){
	int n;
	cin>>n;
	char l[n][20];
	for(int i=0;i<n;i++)
		cin>>l[i];
	int len=0;
	for(int i=0;i<n;i++){
		if(len+strlen(l[i])>=80){
			cout<<endl;
			cout<<l[i];
			len=strlen(l[i]);
		}
		else if(len==0){
			cout<<l[i];
			len+=strlen(l[i]);
		}
		else {
			cout<<' '<<l[i];
			len+=strlen(l[i])+1;
		}
	}
	return 0;
}


int main()
{
	int n;
	int i;
	int l;
	int left = 80;
	char word[10000][42];
	scanf("%d", &n);
	for(i = 0; i<n;i++)
	{
		scanf("%s", word[i]);
	}
	for(i = 0; i<n;i++)
	{
		l = strlen(word[i]);
		if(left == 80)
		{
			printf("%s", word[i]);
			left -= l;
		}
		else if(left >= l+1)
		{
			printf(" %s", word[i]);
			left -= l+1;
		}
		else
		{
			printf("\n%s", word[i]);
			left = 80 - l;
		}
	}
	return 0;
}


int main()
{
	int n, len, i, letter, flag;
	cin >> n;
	char word[1000][41];
	len = 0;
	letter = 0;
	flag = 0;
	for (i = 0; i < n; i++)
	{
		cin >> word[i];
	}
	for (i = 0; i < n; i++)
	{
		if (flag == 1)
		{
			letter++;
		}
		len = strlen(word[i]);
		letter += len;
		if (letter > 80)
		{
			cout << endl;
			letter = len;
			flag = 0;
		}
		if (flag == 1)
		{
			cout << " " << word[i];
		}
		else
		{
			cout << word[i];
			flag = 1;
		}
	}
	return 0;
}


main(){
	struct word{
		char a[41];
		int l;
	};
	struct word w[10000];
	int n, i, sum;
	scanf("%d", &n);
	for(i=0; i<n; i++){
		scanf("%s", w[i].a);
		w[i].l=strlen(w[i].a);
	}
	for(i=n; i==n; i++) w[i].l=0;
	sum=0;
	for(i=0; i<n; i++){
		sum+=w[i].l+1;
		if(sum+w[i+1].l<81){
			if(i==n-1) printf("%s", w[i].a);
			else  printf("%s ", w[i].a);
		}
		else{
			if(i==n-1) printf("%s", w[i].a);
			else {
				printf("%s\n", w[i].a);
				sum=0;
			}
		}
	}
}


/*
 * 1.cpp
 *
 *  Created on: 2013-1-13
 *      Author: Administrator
 */
int main()
{
	int n, i, sum = 0;
	char word[1000][50];
	cin >> n;
	for(i = 1; i <= n; i++)
	{
		cin >> word[i];
	}
	for(i = 1; i <= n; i++)
	{
		cout << word[i];
		sum += strlen(word[i]);
		if(i < n && sum + strlen(word[i + 1]) + 1 <= 80)
		{
			cout << " ";
			sum++;
		}
		else
		{
			cout << endl;
			sum = 0;
		}

	}
	return 0;
}


int main()
{
int n,i,sum=0,len=0;
char word[40];
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%s",word);
len=strlen(word);
if(len+sum>80)
{
 printf("\n");
 printf("%s",word);
 sum=len;
}
else
{ if(sum==0)
 {printf("%s",word);
 sum=sum+len;}
 else
{ sum=sum+len+1;
  if(sum>80)
 {printf("\n");
 printf("%s",word);
 sum=len;}
else
printf(" %s",word);
}}
}
return 0;
}


void main()
{
	int n,i,len[MAX1],line=0;
	char word[MAX1][MAX2];

	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s",word[i]);
		len[i]=strlen(word[i]);
	}

	for(i=0;i<n;i++){
		printf("%s",word[i]);
		line+=len[i];
		if( line+1+len[i+1]>80 ){
			putchar('\n');
			line=0;
		}
		else if(i<n-1){
			putchar(' ');
			line++;
		}
	}
}


void main()
{
	int n,i,l,s,t;
	char word[40];
	scanf("%d",&n);
	scanf("%s",word);
	printf("%s",word);
	l=strlen(word);
	s=l;
	t=0;
	for(i=1;i<=n-1;i++)
	{
		scanf("%s",word);
		l=strlen(word);
		s+=l;
		t++;
		if(s+t<=80)
			printf(" %s",word);
		else
		{
			printf("\n");
			printf("%s",word);
			s=l;
			t=0;
		}
	}
}


char c[45];
int main()
{
	int n,cnt=0,s=0;
	cin>>n;
	while(cnt<=n)
	{
		while(1){
		memset(c,0,sizeof(c));
		cin>>c;//??????
		cnt++;
	  if(cnt==1||cnt==n){if(cnt==1) {cout<<c;s=strlen(c);}
	  							else cout<<' '<<c<<endl;}
	  else {s+=strlen(c)+1;
			if(s>80){cout<<endl<<c;break;}
		else cout<<' '<<c;}
		}
		s=strlen(c);
	}

}


int main()
{
    int i;
    int count;
    char *buf;
    char **words;
    int line_word_count = 0;
    scanf("%d", &count);
    words = (char **)malloc(count * sizeof(char *));
    for (i = 0; i < count; i++) {
        buf = (char *)malloc(41 * sizeof(char));
        scanf("%s", buf);
        *(words + i) = buf;
    }
    for (i = 0; i < count; i++) {
        if (i != count - 1 && line_word_count + strlen(*(words +i)) + 1 > 80) {
            printf("\n");
            line_word_count = 0;
        }
        if (line_word_count != 0) {
            line_word_count += 1;
            printf(" ");
        }
        line_word_count += strlen(*(words + i));
        printf("%s", *(words +i));
    }
    return 0;
}


int main()
{  char a[1000][42];
   int sum,i,j,k,n,m;
   cin>>n;
   sum=0;
   for (i=1;i<=n;i++)
        {cin >>a[i];
         m=strlen(a[i]);
         if (sum+m+1<=80)
             if (sum!=0)
                  { cout<<" "<<a[i];
                    sum=sum+m+1;
                    }
              else { cout<<a[i];
                     sum=sum+m;
                      }
         else { cout<<endl;
                cout<<a[i];
                sum=0;
                sum=sum+m;
                   }
         }
    return 0;

    }


int main()
{
	char ch[1000][40]={'\0'};
	char *p=NULL;
	int n,i,line=0;
	cin>>n;
	for(i=0;i<n;i++)
	{cin>>*(ch+i);}
	line=strlen(*ch);
	i=0;
	while(i<n)
	{line=strlen(*(ch+i));cout<<*(ch+i);i++;if(i==n) break;line+=strlen(*(ch+i));//???????????????????????
	while(line<80)
	{cout<<' ';cout<<*(ch+i);
	i++;line++;if(i==n) break;
	line+=strlen(*(ch+i));}
	cout<<endl;
	}

		return 0;
}


int main()
{
	int n, count = 0, j = 1, l;
	char a[41];
	cin >> n;
	for ( int i=1;i<=n;i++)
	{
		cin>>a;
		l=strlen(a);
		count=count+l;
		if(count<80&&count!=l)
		{
			cout<<" "<<a;
			count++;
		}
		else if(count<80&&count==l)
		{
			cout<<endl<<a;
		}

		else
		{
			cout<<endl;
			cout<<a;
			count=l;
		}
	}
	return 0;
}


struct N{
 char w[50];
 int n;
 struct N *next;
};
int main(){
 struct N *p,*q,*head;
 int n,d,i;
 scanf("%d",&n);
 for(i=1;i<=n;i++){
	 p=(struct N*)malloc(sizeof(struct N));
	 if(i==1){
	     head=p;
	     q=p;
	 }
	 else{
		 if(i!=n){
		  q->next=p;
		  q=p;
		 }
		 else{
		  q->next=p;
		  p->next=NULL;
		 }
	}}
 p=head;
 for(i=1;i<=n;i++){
  scanf("%s",p->w);
  p->n=(strlen(p->w)+1);
  p=p->next;
 }
 d=-1;
 p=head;
 for(i=1;i<=n;){
	 if(d==(-1))
	 { printf("%s",p->w);
	    i++;
	   d=d+(p->n);
	   p=p->next;}
	 if((d+(p->n))<=80&&d!=(-1)){
	  printf(" %s",p->w);
	  i++;
	  d=d+(p->n);
	  p=p->next;if(p==NULL){break;}
	 }
	 if((d+(p->n))>80){
	  printf("\n");
	  d=-1;
	 }
 }
 return 0;
}


int main()
{
	char str[100000],*p = NULL;
	int n,count = 0;
	cin >> n;
	cin.get();
	cin.getline(str,10000);
	p = str;
    for(p = str; *p != '\0';p++)
	{
		count++;
		if(count == 81)
		{
		   if(*p != ' ')
			{
				while(*p != ' ')
					p--;
			}
            *p = '\n';
			count = 0;
		}

	}
	for(p = str; *p != '\0'; p++)
	{
	        cout << *p;
	}
	cout << endl;
		return 0;
}


int main()
{
	char word[40];
	int i,n,len,hang=0,shou=1;
	scanf("%d",&n);
	for(i=0;i<n;i++)
			{
			 scanf("%s",word);
			 len=strlen(word);
			 hang+=len;
			 hang+=1;
			 if(hang<=80)
						 { if(shou==1)
						   { printf("%s",word);hang-=1;}
							 else 	{ printf(" %s",word);}
						    shou=0;
						 }
			 else if(hang>80){printf("\n");printf("%s",word); shou=0;hang=len;}
			}

return 0;
}


int getone(char* s)
{
	int count = 0;
	if(!cin.get(*s))
		return -1;
	while(*s != ' ' && *s != 0)
	{
		s++;
		count++;
		if (!cin.get(*s))
		{
			break;
		}
	}
	*s = 0;
	return count;
}

int main()
{
	int n;
	cin >> n;
	cin.get();
	char s[41];
	int c = 0;
	int r = 80;
	for(int i = 0 ; i < n ; i++)
	{
		c = getone(s);
		if (r == 80)
		{
			cout << s;
			r -= c;
		}
		else
		{
			if (r > c)
			{
				cout << ' ' << s ;
				r -= c+1;
			}
			else
			{
				cout << endl << s;
				r = 80 - c;
			}
		}
	}
}


int main(){
	int g,cco=0;
	cin>>g;
	char b[45];
	cin>>b;
	cout<<b;
	cco=strlen(b);
	for(int i=1;i<g;i++){
		char a[45];
		char *p=a;
		cin>>a;
		cco+=strlen(a);
		if(cco<80){
			cout<<" "<<p;
			cco++;
		}
		else{
			cco=0;
			cout<<endl<<p;
			cco+=strlen(a);
		}
	}
return 0;
}


int main()
{
  int n;
  int i,j;
  int k;
  int end=0;;
  scanf("%d",&n);
  char dz[50];
  for(i=0;i<n;i++)
  {
     for (i = 0; i < n; i++) {
    scanf("%s", dz);
    k = strlen(dz);

    if (end + k +1> 80) {
        printf("\n");
        end = 0;
    }
    else if (end > 0) {
        printf(" ");
        end++;
    }
    printf("%s", dz);
    end += k;
}
  }
return 0;
}


int main()
{
    int num;
    char word[1000][50]={' '};
    int length[1000]={0};
    cin >> num;
    int i;
    for (i=0;i<num;i++)
    {
        cin >> word[i];
        length[i] = strlen(word[i]) + 1;
    }
    int sumlength = 0;
    for (i=0;i<num;i++)
    {
        sumlength+=length[i];
        if (sumlength > 81)
        {
            cout << endl;
            cout << word[i] << " ";
            sumlength = length[i];
        }
        else
        {
            if (sumlength == 81)
            {
                cout << word[i];
                cout << endl;
                sumlength = 0;
            }
            else
            {
                cout << word[i];
                if (sumlength+length[i+1]<=81 && i!=num-1)
                {
                     cout << " ";
                }
            }
        }
    }    return 0;
}


int main()
{
	int n, l[10000], num = -1, i;
	char str[10000][41];
	cin >> n;
	for ( i = 0; i < n; i ++ )
	{
		cin >> str[i];
		l[i] = strlen ( str[i] );
	}
	for ( int i = 0; i < n; i ++ )
	{
		if ( i == n - 1 )
		{
			cout << str[i];
			break;
		}
		if ( num <= 0 )
			num = l[i];
		num = num + l[i+1];
		if ( num >= 80 )
		{
			num = -1;
			cout << str[i] << endl;
		}
		else
			cout << str[i] << " ";
		num ++;
	}
	return 0;
}


/*
 * homework3.cpp
 *
 *  Created on: 2012-12-4
 *      Author: Lixurong
 */

int main()
{
	char a[1000][41];
	int n;
	cin >> n;
	for( int i=0; i<n; i++ )
	{
		cin >> a[i];
	}
	int s=0;
	for( int i=0; i<n; i++ )
	{
		s+=strlen(*(a+i))+1;
		if(s>81)
		{
			s=0;
			cout << endl;
			i--;
			continue;
		}
		else
		{
			cout << (*(a+i));
			if( i!=n-1 && s+strlen(*(a+i+1))<=80)
			{
				cout << " ";
			}
		}
	}
}


//
//  main.cpp
//  Homework
//
//  Created by ??? on 13-12-4.
//  Copyright (c) 2013? ???. All rights reserved.
//

int main()
{
    int n,s=0,e=80;
    char a[3200]={0};

    cin>>n;//n??????
    cin.get();
    cin.getline(a,3200);
    a[strlen(a)]=' ';

    while(1)
    {
        while(a[e]!=' ')
            e--;
        for(int i=s;i<e;i++)
            cout<<a[i];
        cout<<endl;
        if(a[e+1]==0)
            return 0;
        s=e+1;
        e=s+80;
    }
}


struct word
{
	char w[20];
	int a;
} word[1000];

int main(int argc, char* argv[])
{
	int i,j,n,line;
	struct word *p;
	p=&word[0];
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		scanf("%s",&p->w);
		p->a=strlen(p->w);
		p++;
	}
	p=&word[0];
	for(i=1;i<=n;i++){
		if(i==1){
			printf("%s",p->w);
			line=p->a;
			p++;
		}else if(line+p->a+1>80){
			printf("\n%s",p->w);
			line=p->a;
			p++;
		}else{
			printf(" %s",p->w);
			line+=p->a+1;
			p++;
		}
	}

	return 0;
}


int main()
{
	int n;
	cin >> n;
	int i, j, k;
	char word[1000][45];

	for (i = 0; i < n; i++)
	{
		scanf("%s", word[i]);
	}
	int sumc = 0;
	for (i = 0; i < n; i++)
	{
	    sumc += strlen(word[i]) + 1;
	    if(sumc + strlen(word[i + 1])> 80)
	    {
	        cout << word[i];
	        cout << endl;
	        sumc = 0;
	    }
	    else if (sumc == 81)
	    {
	        cout << word[i];
	        cout << endl;
	        sumc = 0;
	    }
        else if (i == n - 1)
            cout << word[i];
        else cout << word[i] << " ";
	}
	cout << endl;
	return 0;
}


int main(int argc, char *argv[])
{
  char a[20];
  int n,i,k=0;
  scanf("%d",&n);
  getchar();
  scanf("%s",a);
  printf("%s",a);
  k=strlen(a);
  for(i=1;i<n;i++)
  {
       scanf("%s",a);
       k=k+1+strlen(a);
       if(k>80)
       {
            printf("\n%s",a);
            k=strlen(a);
            continue;
       }
       if(k<=80)
       printf(" %s",a);
  }
  return 0;
}


int main()
{
	int n,i,j,sum=0;
	char s[500][100];
	char *p;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	scanf("%s",s[i]);
	for(i=0;i<n-1;i++)
	{
		for(p=s[i];p<s[i]+strlen(s[i]);p++)
		printf("%c",*p);
		sum+=strlen(s[i])+1;
		if(sum+strlen(s[i+1])>80)
		{
			printf("\n");
			sum=0;
		}
		else printf(" ");
	}
	for(p=s[n-1];p<s[n-1]+strlen(s[n-1]);p++)
	printf("%c",*p);
	return 0;
}


void main()
{
int i,n,c;
char a[40];
scanf("%d",&n);
scanf("%s",&a);
printf("%s",a);
c=strlen(a);
for(i=1;i<=n-1;i++)
{scanf("%s",&a);
if(c+strlen(a)+1<=80)
{printf(" %s",a);
c+=strlen(a)+1;}
else
{c=strlen(a);
printf("\n%s",a);}}}


int main()
{
	int n, l, line = 0;
	int i;
	char word[1000][40];
	cin >> n;
	cin >> word[0];
	line = strlen(word[0]);
	cout<< word[0];
	for (i = 1; i< n; i++)
	{
		cin>>word[i];
		l = strlen(word[i]);
		line = line + l +1;
		if(line <=80)
			cout << ' ' << word[i];
		else
		{
			cout<< endl << word[i];
			line = l;
		}
	}
	return 0;
}


/*
 * y2.cpp
 *
 *  Created on: 2011-1-9
 *      Author: jsgl
 */
int main(){
	char a[401],*p=a;
	int n,len,tolen=0;
	cin>>n;
	cin>>p;
	cout<<p;
	len=strlen(p);
	tolen=len;
	while(n-1){
		cin>>p;
		len=strlen(p);
		tolen+=(len+1);
		if(tolen<=80)
			cout<<" "<<p;
		else {
			cout<<endl;
			cout<<p;
			tolen=len;
		}
		n--;
	}
return 0;
}


int main()
{
	int a,b,c,d=0,e,f,g;
	char s[45],t[45];
	scanf("%d",&a);
	scanf("%s",s);
	printf("%s",s);
	d=strlen(s);
	for(b=1;b<a;b++)
	{
		scanf("%s",s);
		c=strlen(s);
		d=d+c+1;
		if(d>80)
		{
			printf("\n");
			printf("%s",s);
			d=strlen(s);
		}
		else
		{

		printf(" ");
		printf("%s",s);
		}
	}
}


int main()
{
	int n, i, length=0;
	char a[1000][42];
	scanf("%d", &n);
	scanf("%s", a[0]);
	printf("%s", a[0]);
	length=strlen(a[0]);
	for(i=1; i<n; i++)
	{
		scanf("%s", a[i]);
		length=length+strlen(a[i])+1;
		if(length<=80)
			printf(" %s", a[i]);
		else
		{
			printf("\n");
			printf("%s", a[i]);
			length=strlen(a[i]);
		}
	}
	return 0;
}


/*
 * y2.cpp
 *
 *  Created on: 2011-1-9
 *      Author: jsgl
 */
int main(){
	char a[401];
	int n,len,tolen=0;
	cin>>n;
	cin>>a;
	cout<<a;
	len=strlen(a);
	tolen=len;
	while(n-1){
		cin>>a;
		len=strlen(a);
		tolen+=(len+1);
		if(tolen<=80)
			cout<<" "<<a;
		else {
			cout<<endl;
			cout<<a;
			tolen=len;
		}
		n--;
	}
return 0;
}


int main(){
	char c[41];
	char *p=c;
	int n;
	cin>>n;
	int i;
	int j;
	int num=0;
	for(i=1;i<=n;i++)
	{
		cin>>c;
		for(;*p!=0;p++);
		j=p-c;
		if(num==0)
		{
			cout<<c;
			num=j;
		}
		else{
		if((num+j+1)>80)
		{
			cout<<endl<<c;
			num=j;
		}
		else if((num+j+1)==80)
		{
			cout<<' '<<c<<endl;
			num=0;
		}
		else
		{
			cout<<' '<<c;
			num+=(j+1);
		}
		}
		p=c;
	}
}


main()
{
      int n;
      scanf ("%d",&n);
      int i,j;
      char a[2000][50];
      int length[2000]={0};
      for (i=0;i<n-1;i++)
      {
          scanf ("%s ",a[i]);
          length[i]=strlen(a[i]);
      }
      scanf ("%s",a[n-1]);
      length[n-1]=strlen(a[n-1]);
      //int ed=0;
      int total=80;
      for (i=0;i<n;i++)
      {
          if (length[i]<total)
          {
            if (i==n-1) printf ("%s\n",a[i]);
            else
            {
              if (length[i]+length[i+1]+1<=total)
              {
                   printf ("%s ",a[i]);
                   total=total-length[i]-1;
              }
              else if (length[i]+length[i+1]+1>total)
              {
                   printf ("%s\n",a[i]);
                   total=80;
              }
            }
          }
          else if (length[i]==total) { printf ("%s\n",a[i]); total=80; }
          else if (length[i]>total) { printf ("\n"); i=i-1; total=80; }
      }
      //printf ("\n");
}


char a[81];
void do_a(void)
{
	if (a[0] == '\n')
	{
		for (int i = 0; i < strlen(a) ; i++)
		{
			a[i] = a[i + 1];

		}
	}
	if (a[strlen(a) - 1] == '\n')a[strlen(a) - 1] = '\0';
}
int main()
{
	int b;
	cin >> b;
	int t = 0;
	for (int i = 0; i<b;i++)
	{
		cin.getline(a,90, ' ');
		do_a();
		t += strlen(a);

		if (t>=81||t==strlen(a))
		{
			cout << endl << a;
			t = strlen(a) + 1;
		}
		else
		{
			cout << " " << a;
			t += 1;
		}
	}
}


int main()
{
	struct word{
		char w[41];
		int l;
	}a[1000];
	int n,i,temp=-1,t,p=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s",a[i].w);
		a[i].l=strlen(a[i].w)+1;
	}
	do{
		temp=-1;
	    for(i=p;i<n;i++)
		{
		    temp+=a[i].l;
		    if(temp>80)
			{
			    t=i;
			    break;
			}
		}
		if(temp>80)
		{
	        printf("%s",a[p].w);
	        for(i=p+1;i<t;i++)
			{
		        printf(" %s",a[i].w);
			}
		    p=t;
	        printf("\n");
		}
	}while(temp>80);
	printf("%s",a[p].w);
	for(i=p+1;i<n;i++)
	{
		printf(" %s",a[i].w);
	}
	printf("\n");
	return 0;
}


int main()
{
	int n;
	int num=0;
	int linelen=0;
	char a[45]={0};
	cin>>n;
	for(int i=0;i<n;++i)
	{
		cin>>a;
		num=strlen(a);          //ÊäÈëÒ»¸öµ¥´Ê£¬¼ÇÂ¼³¤¶È
		if(num+1+linelen>80)    //Èç¹ûÕâ¸öµ¥´ÊµÄ³¤¶È¼ÓÉÏÇ°Ãæ×Ö·û´®³¤¶È´óÓÚ80µÄ»°
		{
			cout<<endl<<a;  //ÏÂÒ»ÑùÊä³öÕâ¸öµ¥´Ê
			linelen=num;         //²¢ÇÒÖØÖÃÏÂÒ»ÐÐµ¥´Ê³¤¶È
		}
		else
		{
			if(linelen !=0){
				linelen+=num+1;
				cout<<" ";
			}
			else{
				linelen=num;
			}
			cout<<a;   //Êä³ö¸Äµ¥´Ê+¿Õ¸ñ
		}
	}
	cin>>n;
	return 0;
}


int main()
{
	int n;
	cin>>n;
	char str[1000][50];   //????
	int len=0;
	for(int i=1;i<=n;i++)
		cin>>*(str+i);
	for(int i=1;i<=n;i++)
	{
		if(len==0)
		{
			len=strlen(*(str+i));
			cout<<*(str+i);
		}
		else if(len+1+strlen(*(str+i))<=80)
		{
			len=len+1+strlen(*(str+i));
			cout<<" "<<*(str+i);
		}
		else if(len+1+strlen(*(str+i))>80)
		{
			len=strlen(*(str+i));
			cout<<endl<<*(str+i);
		}
	}
	return 0;
}


int main()
{char s[43];
int m,n,sum=0,i,k;
char *p=s;
scanf("%d\n",&n);
scanf("%s",s);
printf("%s",s);
sum=strlen(s);
for(i=2;i<=n;i++)
   {scanf("%s",s);
   m=strlen(s);
   sum=sum+m+1;
   if(sum<=80)
      {printf(" %s",s);
			}
	else
	{printf("\n%s",s);
	sum=strlen(s);}
	for(k=0;k<=41;k++)
	{*p='\0';
	p=p+1;}
	p=s;
   }
  return 0;
}


int main()
{
    int n, i, count = 0, len = 0;
	char str[500][40], (*p)[40];
	cin >> n;
	p = str;
	for (i = 0; i<n; i++)
		cin >> *(p+i);
	for (i = 0; i<n-1; i++)
	{
		len = strlen(*(p+i));
		if (count + len <= 80)
		{
			if (count + len + 1 + strlen(str[i+1]) <= 80)
			{
				cout << *(p+i) << " ";
				count += len + 1;
			}
			else
			{
				cout << *(p+i);
				cout  << endl;
				count = 0;
			}
		}
		else
		{
			cout <<"#"<< endl;
			cout << *(p+i);
			count = len + 1;
		}
	}
	len = strlen(*(p+n-1));
	if (count + len + 1 <=80)
	{
		cout << *(p+n-1);
		cout << endl;
	}
	else
    {
		cout << endl;
		cout << *(p+n-1) << endl;
	}
	return 0;
}


int main()
{
    int n, i, j, sum, l;
    char a[41];
    char *p = a;
    cin >> n;
    sum = 0;
    for (i = 1; i <= n; i++)
    {
       cin >> a;
       l = strlen(a);
       if (sum == 0)
       {
            for (j = 0; j <l; j++) cout << *(p+j);
            sum = l;
        }
       else
       if ( sum + l + 1 <= 80)
       {
            cout << ' ' ;
            for (j = 0; j <l; j++) cout << *(p+j);
            sum = sum + l +1;
       }
       else
       {
           sum = l;
           cout << endl<< a;
       }
    }
    return 0;
}


int main(){
	int n,i,count=0;
	int len[10000];
	char sz[10000][21]={'\0'};
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s",sz[i]);
	}
	for(i=0;i<n;i++){
		len[i]=strlen(sz[i]);
	}
	for(i=0;i<n-1;i++){
		count=count+len[i]+1;
		if(count>81){
			printf("\n");
			count=0;
			continue;
		}
		else if((count-1<=80)&&(count+len[i+1]>80)){
			printf("%s\n",sz[i]);
			count=0;
			continue;
		}
		else if((count<=80)&&(count+len[i+1]<=80)){
			printf("%s ",sz[i]);
			continue;
		}
	}
	printf("%s",sz[n-1]);
	return 0;
}


int main()
{
      int n;
      scanf("%d",&n);
      char word[n][20];
      int i,sum=0;
      scanf("%s",word[0]);
      sum+=strlen(word[0])+1;
      for(i=1;i<n;i++){
              scanf("%s",&word[i]);
              sum+=strlen(word[i]);
              if(sum>80){
                      printf("%s\n",word[i-1]);
                      sum=strlen(word[i])+1;
               }
               else{
                      printf("%s ",word[i-1]);
                      sum+=1;
              }
      }
      printf("%s",word[n-1]);
}


char word[45];
int length=0;

int main()
{
    int n,i=0;
    scanf("%d",&n);
    while((i++)<n)
    {
        scanf("%s",word);
        int len=strlen(word);
        if(length+len+1<=80)
        {
            length+=len;
            if(i!=1)
            length++,
            cout<<" "<<word;
            else
            cout<<word;
        }
        else
        {
            cout<<endl<<word;
            length=len;
        }
    }
    return 0;

}


int main()
{
	int a,sum=0,i;
	char s[50];
	scanf("%d",&a);
	for (i=1;i<=a;i++)
	{
		scanf("%s",s);
		if (!sum)
		{
			printf("%s",s);
			sum=sum+(int)strlen(s);
		}
		else
		{
			if (sum+strlen(s)+1>80)
			{
				sum=0;
				printf("\n%s",s);
				sum=sum+(int)strlen(s);
			}
			else
			{
				sum=sum+(int)strlen(s)+1;
				printf(" %s",s);
			}
		}
	}
	return 0;
}


int main()
{
	int n;
	cin>>n;
	char ch[300][50];
	int lengthch[300];
	for (int i=0;i<n;i++)
	{
		cin>>*(ch+i);
	    *(lengthch+i)=strlen(*(ch+i));
	}
	int num=80;
	for (int i=0;i<n;i++)
	{
		if (i==n-1) cout<<*(ch+i);
		else {
		if (num-*(lengthch+i)-*(lengthch+i+1)>0)
		{cout<<*(ch+i)<<' ';num=num-*(lengthch+i)-1;}
		else
		{cout<<*(ch+i)<<endl;num=80;}}
	}
	return 0;
}


int main()
{
	int i, k=0, a, n;
	char word[500][40]={0};
	char para[50][82]={0};
	scanf("%d", &n);
	for(i=0;i<n;i++)
		scanf("%s", word[i]);
	strcat(para[k], word[0]);
	for(i=1;i<n;i++){
        if(strlen(para[k])+strlen(word[i])+1<=80){
			strcat(para[k], " ");
			strcat(para[k], word[i]);
		}
		else{
			//printf("%d", strlen(para[k]));
			k++;
			strcat(para[k], word[i]);
		}
	}
	for(i=0;i<=k;i++)
		printf("%s\n", para[i]);
	return 0;
}


int main()
{
    int l=0,i,n;
    char word[1500][50];
    cin>>n;
    for(i=0;i<n;i++)
    	cin>>*(word+i);
    for(i=0;i<n-1;i++)
    {
    	if(l+strlen(*(word+i))==80)
    	{
    		l=0;
    		cout<<*(word+i)<<endl;
    	}
    	else if(l+strlen(*(word+i))<80)
    	{
    		if(l+strlen(*(word+i))+1+strlen(*(word+i+1))<=80)
    		{
    			cout<<*(word+i)<<' ';
    			l=l+strlen(*(word+i))+1;
    		}
    		else
    		{
    			cout<<*(word+i)<<endl;
    			l=0;
    		}
    	}
    }
    cout<<*(word+i);
	return 0;
}


void main()
{
	struct word
	{
		char a[100];
		int line;
		int num;
		int flag;
	}word1[1000]={0};
    int i,j,n,k,sum=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s",word1[i].a);
	}
	for(j=0;j<n;j++)
	{
		sum+=(1+strlen(word1[j].a));
		(word1[j].num)++;
		if(sum>81)
		{
			sum=strlen(word1[j].a)+1;
			word1[j].num=0;
			(word1[j].line)++;
			word1[j-1].flag=1;
		}
	}

    for(k=0;k<n-1;k++)
	{
		if(word1[k].flag==0)
		{
			printf("%s ",word1[k].a);
		}
		if(word1[k].flag==1)
		{
			printf("%s\n",word1[k].a);
		}
	}
printf("%s\n",word1[n-1].a);
}


int main()
{
	char str[2000][41];
	int n;
	cin >> n;
	int i;
	int length[2000];
	int *p = length;
	for(i = 1; i <= n; i++)
	{
		cin >> str[i];
        *(p + i) = strlen(str[i]);
	}
	*(p + i) = 1000;
	int total = 80;
	for(i = 1; i <= n; i++)
	{
		if(*(p + i) <= total)
		{
			cout << str[i];
			total -= *(p + i);
			total--;
			if(*(p + i + 1) <= total)
				cout << " ";
		}
		else
		{
			cout << endl;
			total = 80;
			i--;
		}
	}
	return 0;
}


int main()
{
	char word[9999][50];
	int i , j , n , len , cnt = 0;
	cin >> n;
	for(i = 0 ; i < n ; i++)
		cin >> word[i];
	for(i = 0 ; i < n - 1 ; i++)
	{
		if(cnt + strlen(word[i])   <= 80 && cnt + strlen(word[i]) + 1 + strlen(word[i + 1])  > 80 )
		{
			cout << word[i] << endl;
			cnt = 0;
		}
		else//(cnt + strlen(word[i]) + 1 <= 80 && cnt + strlen(word[i]) + 1 + strlen(word[i + 1]) + 1 <= 80)
		{
			cout << word[i] << " " ;
			cnt = cnt + strlen(word[i]) + 1;
		}

	}
	cout << word[n - 1];
	return 0;
}


//????
int main()
{
	int n, num = 0;
	char word[41];
	cin >> n;
	for(int k = 0; k < n; k++)
	{
		cin >> word;
		if(num == 0)
		{
			cout << word;
			num += strlen(word);
			continue;
		}
		num += strlen(word) + 1;
		if(num <= 80)
		{
			cout << ' ' << word;
		}
		else
		{
			cout << endl << word;
			num = strlen(word);
		}
	}
	return 0;
}


int main(){
	int n,i,charnum=0;
	cin>>n;
	char a[n][100];
	for(i=0;i<n;i++)
	cin>>*(a+i);
    for(i=0;i<n;i++){
       charnum+=strlen(*(a+i))+1;
       if(charnum+strlen(*(a+i+1))>80 && charnum<=81)
    	   cout<<*(a+i);
       if(charnum+strlen(*(a+i+1))<=80&&i!=n-1)
           cout<<*(a+i)<<" ";
       if(charnum+strlen(*(a+i+1))<=80&&i==n-1)
                  cout<<*(a+i);
       if(charnum>81){
    	       cout<<endl;
    	       cout<<*(a+i)<<" ";
    	       charnum=strlen(*(a+i))+1;
       }
    }
	return 0;
}


int main()
{
	int n,i,lw,len=0;
	char p[100],w[100];
	scanf("%d",&n);
	strcpy(p,"");
    for(i=0;i<n;i++)
	{
		printf("%s",p);
		scanf("%s",w);
		lw=strlen(w);
		if(len+lw>80)
		{
			printf("\n");
			len=0;
		}else if(i!=0)printf(" ");
		len+=lw+1;
		strcpy(p,w);
	}
	printf("%s\n",p);

	return 0;
}


int main()
{
	int n,i,m=0;
	char word[41];
	scanf("%d",&n);
	scanf("%s",word);
	for(i=0;i<n;i++)
	{
		if(m==0)
		{
			printf("%s",word);
			m=m+strlen(word);
			scanf("%s",word);
		}
		else
		{
			if(m+strlen(word)+1>80)
			{
				printf("\n");
				m=0;
				i--;
			}
			else
			{
				printf(" %s",word);
				m=m+strlen(word)+1;
				scanf("%s",word);
			}
		}
	}
	return 0;
}


int main()
{
	int n;
	scanf("%d",&n);
	char s1[41];
	char s2[41];
	char *now;
	char *next;
	char *mid;
	int i,j;
	int nowlen;
	int thislen;
	scanf("%s",s1);
//			printf("%s\n",s1);
	now = s1;
	next = s2;
	nowlen = strlen(s1);
	for(i = 0;i < n - 1;i++)
	{
		for(j = 0;j < 41;j++)
			next[j] = '\0';
		scanf("%s",next);
//					printf("%s\n",next);
		thislen = strlen(next);
//							printf("%d %d\n",nowlen,thislen);
		if(nowlen + thislen + 1 <= 80)
		{
			printf("%s ",now);
			nowlen = nowlen + thislen + 1;
		}
		else
		{
			printf("%s\n",now);
			nowlen = thislen;
		}
		mid = now;
		now = next;
		next = mid;
	}
	printf("%s",now);
	return 0;
}


int main()
{
	int numofwords=0,numofchar=0;// num of char is used to count the num in the line
	int lenofwords[1000]={0};
	int i=0,flag=0;
	char words[1000][40];
	cin>>numofwords;
	cin.get();
	while(numofwords>0)
	{
		scanf("%s",words[i]);//cin the words
		cin.get();
		lenofwords[i]=strlen(words[i]);
		numofwords--;
		if((numofchar+lenofwords[i]+1<=80)&&(flag==1))
        {
			cout<<" ";
			printf("%s",words[i]);
         numofchar=numofchar+lenofwords[i]+1;
        }
         else if ((numofchar+lenofwords[i]<=80)&&(flag==0))
         {
              printf("%s",words[i]);
              flag=1;
              numofchar=numofchar+lenofwords[i];
         }
         else
         {
             printf("\n");
             cout<<endl<<words[i];
             flag=1;
             numofchar=lenofwords[i];
         }
		i++;
	}
    return 0;
}


int main(){
	int n,i=0,len,L=0;
	char ori[300][42];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s",ori[i]);
	}
	printf("%s",ori[0]);
	L+=strlen(ori[0]);
	for(i=1;i<n;i++){
		L+=strlen(ori[i])+1;
		if(L>80){
			L=0;
			printf("\n%s",ori[i]);
			L+=strlen(ori[i]);
		}else{
			printf(" %s",ori[i]);
		}
	}

	return 0;
}


int main()
{
	int i, n, j=0, l = 0, m=0,t=0, k;
	char str[10000];
	cin >> n;
	cin.get();
	cin.getline(str,10000);
	k = strlen(str);
	for ( i = 0 ; i < k ; i++ )
	{
		t++;
		if ( str[i] != ' ')
			m++;
		else
		{
			if ( t > 81)
			{
				if ( l != 0)
				{
					for ( j = l ; j < i - m - 1 ; j++ )
						cout << str[j];
					l = l + t - m - 1;
					i = i - m - 1;
					cout << endl;
					t=0;
				}
				else
				{
					for ( j = l; j < i - m - 1 ; j++ )
						cout << str[j];
					l = l + t - m - 1;
					i = i - m - 1;
					cout << endl;
					t=0;
				}
			}
			if ( t == 81 )
			{
				if ( l != 0 )
				{
					for ( j = l ; j < i ; j++ )
						cout << str[j];
					l = l + t;
					cout << endl;
					t=0;
				}
				else
				{
					for ( j = l ; j < i ; j++ )
						cout << str[j];
					l = l + t ;
					cout << endl;
					t=0;
				}
			}
			m=0;
		}
	}
	for ( j = l  ; j < k ; j++ )
		cout << str[j];
	return 0;
}


int main(int argc, char *argv[])
{
  char word[40];
  int n,m,i,j,k,p,q,sum=0,flag=0;
  scanf("%d",&n);

  for(i=0;i<n;i++)
  {
       scanf("%s",word);
       if(sum==0)
       {
         printf("%s",word);

       }

       if(sum!=0&&sum<=80&&(sum+strlen(word))<=80)
       {
         printf(" %s",word);

       }

       if(sum!=0&&sum<=81&&(sum+strlen(word))>80)
       {
         printf("\n%s",word);sum=0;

       }
        sum+=strlen(word)+1;
  }

  return 0;
}


int main()
{
    int n,i,num,len;;
    char w[50];
    scanf("%d",&n);
    num=0;
    scanf("%s",w);
    len=strlen(w);
    for(i=0;i<n;i++)
    {
        if(num+len<=80)
        {
            if(i!=n-1)
            {
                printf("%s",w);
                num=num+len+1;
            }
            else
            printf("%s",w);
        }
        else
        {
            printf("\n");
            num=len+1;
            printf("%s",w);
        }
        scanf("%s",w);
        len=strlen(w);
        if((num+len<=80)&&(i!=n-1))
        printf(" ");
    }
}


int main(void){
	int n, i;
	char word[41];
	scanf("%d", &n);
	int curLen;
	curLen = 0;
	int afterLen;
	int wordLen;
	for (i=0; i<n; i++){
		scanf("%s", word);
		wordLen = strlen(word);
		if (curLen == 0){
			afterLen = curLen+wordLen;
			if (afterLen<=80){
				printf("%s", word);
				curLen = afterLen;
			}
			else{
				printf("\n%s", word);
				curLen = wordLen;
			}
		}
		else {
			afterLen = 1+curLen+wordLen;
			if (afterLen<=80){
				printf(" %s", word);
				curLen = afterLen;
			}
			else{
				printf("\n%s", word);
				curLen = wordLen;
			}
		}
	}
	printf("\n");
	return 0;
}


/*
 * wordedit.cpp
 *
 *  Created on: 2013-12-7
 *      Author: sony
 */

int main(){
	char word[503][40];
	int sum = 0,n;
	cin>>n;
	for(int i = 0;i < n;i++){
            cin>>word[i];
            }
	cout<<word[0];
	sum = strlen(word[0]) + 1;
    for(int i = 1;i < n;i++){
    	sum = sum +strlen(word[i]);
    if(sum  <= 80){
    	   cout<<' ';
           sum ++;
           }
    else {
         cout<<endl;
         sum = strlen(word[i]) + 1;
         }
    cout<<word[i];
    }
    return 0;
}


int main()
{
    int i,n,num=0,len;
    char s[100];
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        scanf("%s",s);
        len=strlen(s);
        if(num==0)
        {
            printf("%s",s);
            num=len;
            continue;
        }
       if(num+len<80)
       {
           printf(" %s",s);
           num=num+len+1;
           continue;
       }
       if(num+len>=80)
       {
           printf("\n%s",s);
           num=len;
           continue;
       }
    }
    return 0;
}


int main( )
{
	char a[250][45]={'\0'},c;
	int n,i,h,l,countnum;
	cin>>n;
	h=0;
	for(i=0;i<n;i++)
	{
		cin>>*(a+i);

	}
	countnum=0;
	i=0;
	while(i<n)
	{
		if((countnum+strlen(*(a+i)))<80)
		{
			if(countnum==0)
			{cout<<*(a+i);
			countnum=countnum+strlen(*(a+i));
			i++;}
			else
			{
				cout<<" "<<*(a+i);
				countnum+=strlen(*(a+i))+1;
				i++;
			}
		}
		else
		{
			cout<<endl;
			countnum=0;
		}
	}

	return 0;
}


int main()
{
	int n,i;
	scanf("%d",&n);
	char s[500][41];
	for(i=0;i<n;i++)
	{
		scanf("%s",s[i]);
	}
	int count=-1;
	for(i=0;i<n;i++)
	{
		count+=strlen(s[i])+1;
		if((count-strlen(s[i])-1)==-1)
                {
                        printf("%s",s[i]);
                        continue;
                }
		else if(count>0&&count<=80)printf(" %s",s[i]);
		else if(count>80)
		{
			count=-1;
			i--;
			printf("\n");
		}

	}

	return 0;
}


int main()
{  int n,i,j,k,t;
   char word[40];

   scanf("%d",&n);

   for(i=0,t=81;i<n;i++)
   {scanf("%s",word);
     k=strlen(word);
	 if(t-k-1>=0)
	  { if(t==81) printf("%s",word);
		 else printf(" %s",word);
       t=t-k-1;
	  }
	 else  {printf("\n");
	        t=81-k-1;
		    printf("%s",word);}
   }
     printf("\n");
    return 0;
}


int main()
{
	char a[300][40];
	int i=0,n,words=0;
	cin>>n;
	do
	{
		cin>>a[i];
		i++;
	}
	while(i<n);
	for(i=0;i<n;i++)
	{
		words=words+strlen(a[i])+1;
		if(i!=n-1)
		{
			if(words+strlen(a[i+1])<=80)
			{
				cout<<a[i]<<" ";
			}
		    else
			{
				cout<<a[i]<<endl;
			    words=0;
			}
		}
		if(i==n-1)
		{
			cout<<a[i];
		}
	}
	return 0;
}


int main()
{
    int n, i, j, sum, l;
    char a[41];
    char *p = a;
    cin >> n;
    sum = 0;
    for (i = 1; i <= n; i++)
    {
       cin >> a;
       l = strlen(a);
       if (sum == 0)
       {
            for (j = 0; j <l; j++) cout << *(p+j);
          //  cout << a;
            sum = l;
        }
       else
       if ( sum + l + 1 <= 80)
       {
            cout << ' ' << a;
            sum = sum + l +1;
       }
       else
       {
           sum = l;
           cout << endl<< a;
       }
    }
    return 0;
}