semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
/*
 * 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;
}
//********************************
//*??????? **
//*?????1300062805 **
//*???2013.12.17 **
//********************************
char c[500][50] = {0};
char (*p)[50];   
int n, i;

int main()
{
	int cnt = 0;

	cin >> n;
	p = c;     //???????
	for( i = 1; i <= n; i++ )
	{
		cin >> *( p + i );   //??
	}
	for( i = 1; i < n; i++ )
	{
		if( cnt + strlen( *( p + i ) ) + 1 + strlen( *( p + i + 1 ) ) <= 80 )
		{
			cout << *( p + i ) << ' ';
			cnt += strlen( *( p + i ) ) + 1;   //??????????????????
		}
		else if( cnt + strlen ( *( p + i ) ) + 1 + strlen (*( p + i + 1 ) ) > 80 )
		{
	
		    cout << *( p + i ) << endl;
			cnt = 0;                        //?????????????????
		}
		
	}
	cout << *(p+n);             //????????
	cout << endl;

	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 length(char *p)
{
	char *p2 = p;
	int i = 0;
	for (;;)
	{
		if (*p2++ == 0)
			break;
		i++;
	}
	return i;
}

int main()
{
	int n;
	cin >> n;
	char word[1000][41];
	for (int i = 0; i < n; i++)
	{
		cin >> word[i];
	}
	char *p1 = word[0];
	char *p2 = NULL;
	for (p2 = p1; p1 <= word[n - 1]; p1 = p2 + 41)
	{
		p2 = p1;
		for (int s = -1; s <= 80; p2 += 41)
		{
			if (p2 == word[n])
			{
				p2 += 41;
				break;
			}
			s += length(p2);
			s++;
		}
		p2-= 82;
		cout << p1;
		for (char *p3 = p1+41; p3 <= p2; p3+=41)
		{
			cout << " " << p3;
		}
		cout << endl;
	}
	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;
	}
}
char s[1000],a[100],b[100],word[1000][40],nstr[100][100],result[100];
int number[300];
int main(){
		
	
		int i=0,j=0,k=0,flag=0,n=0,num=0;
	scanf("%d\n",&n);
	for(i=0;i<n;i++){
		scanf("%s",word[i]);
		//printf("%s\n",word[i]);
		number[i]=strlen(word[i]);
		
		//printf("%d\n",number[i]);

	
	}
	i=0;
	j=0;

	while(i<n-1){
		while(((num+number[i]+j)<=80)&&(!flag)){
			
			if((num+number[i]+number[i+1]+j)>=80){
				printf("%s",word[i]);
			}else {
				printf("%s ",word[i]);
			}
			num+=number[i];
			i++;
			j++;
			if(i==n-1)flag=1;
		}
		if(i==n-1){
			printf("%s\n",word[i]);
		}else{
			printf("\n");
		}
		j=0;
		num=0;
	}
	
		return 0;
}
int main(){
	char a[50],*pointa;
	pointa=a;  //?????????
	int m,i,len,temp=0,account=0;
	cin >> m;  //??m????m???
	while(m > 0){  //???m>0?
		m --;  //?????????
		cin >> a;  //?????
		len=strlen(a);  //????
		temp += len;  //temp????????
		if(account==0){  //account????????????????0
			for(i=0;i<len;i++)	cout << *(pointa+i);  //?????
			account ++;  //account??
			continue;  //????
		}
		if(account > 0){  //?account > 0
		if(temp < 80){  //temp??80?
			cout << ' ';  //????
			for(i=0;i<len;i++) cout << *(pointa+i);  //????
			if(temp+1 == 80){  //??????????????80
				cout << endl;  //????
				account = 0;  //account????
				temp = 0;  //temp????
			}
			else{  //???
			account ++;  //account????
			temp ++;  //temp????
		}}
		if(temp >= 80){  //?temp????80
			cout << endl;  //??????
			for(i=0;i<len;i++)	cout << *(pointa+i);   //??????????
			account = 1;  //account??1
			temp = len;   //temp???????
		}}}
	return 0;   //?????
}
/*
?? 
??????????????????????????????????
????????80?????????????????????????????????????????????????????
 
???? 
?????????????????????????n??????????????????????????????????????40?????
 
???? 
??????????????????80???????????????????????????? 
*/


int main(){
	char word[40], *letterp;
	int letter= 0, words= 0, i= 0, wordlen= 0, linehead= 1, first= 1;
	
	cin>>words;

	for(i= 0; i< words; i++){
		if(letter== 0)
			linehead= 1;
		else
			linehead= 0;
//		cout<<" linehead= "<<linehead<<' ';
		wordlen= 0;
		cin>>word;
		letterp=word;
		for(letterp= word; *letterp!= '\0'; letterp++){
			wordlen++;
		}
//		cout<<"word= "<<word<<", its length is: "<<wordlen<<endl;
		letter+= wordlen;
		if(linehead== 0)
			letter++;
		if(letter> 80){
			cout<<endl<<word;
			letter= wordlen;
		}
		else{
			if(first== 1)
				cout<<word;
			else		
				cout<<' '<<word;
		}
		if(first== 1)
			first= 0;

	}

	return 0;
}
//*****************************
//*???2011?1?9?         *
//*??????               *
//*?????4                *   
//*****************************
int main()//???
{//?????
	int n=0;//????????????
	char a[10000];//????????????????
	cin>>n;//??????
	cin.get();//????
	cin.get(a,10000,'\n');//???????
	char *p=a;//???????????
	int lenth[100]={0};//????????????
	int *q=lenth;
	int m=0;//??????????
	int flag=0;//?????????????
	while(*p!='\0'&&flag==0)//???????
	{
		int i=0;//???
		for(i=0;i<80;i++)
		{
			p++;
			if(*p=='\0')
			{
				flag=1;
				break;
			}
		}//??80?????????????????????
		if(flag==0)
		{
			if(*p!=' ')
				for(;*p!=' ';p--);
			*p='\0';
		}//????????????80??????????????????
		p=a;//?????
		q=lenth;
		for(int j=0;j<m;j++)
		{
			for(i=0;i<*q+1;i++)
				p++;
			q++;
		}//?????????
		for(;*p!='\0';p++)
		{
			cout<<*p;
			lenth[m]++;
		}//????????????
			cout<<endl;//??
		m++;
		q++;
		p++;
	}
	return 0;
}//?????
int main()
{
	int n,b[1000],d[1000];
	cin>>n;
	/*char a[1000][100];*/
	char a[200][100];
	int i,j,k,lc,m;
	for(i=0;i<n;i++)
		cin>>a[i];
	for(i=0;i<n;i++)
	{
		b[i]=strlen(a[i]);}
	/*cin.getline(c,9999);
	lc=strlen(c);
	b[0]=-1;
	j=1;*/
	/*for(i=0;i<lc;i++)
	{
		if(c[i]==' ')
		{
			b[j]=i;m=0;
			for(k=b[j-1]+1;k<b[j];k++)
			{
				a[j-1][m]=c[k];m=m+1;}
			a[j-1][m]='\0';
			j=j+1;
		}
		if(j==n)
			break;
	}
	m=0;
	for(k=b[j-1]+1;k<lc;k++)
	{
		a[n-1][m]=c[k];m=m+1;
	}
	a[n-1][m]='\0';
	for(i=0;i<n;i++)
		d[i]=strlen(a[i]);*/

	/*for(i=0;i<n-1;i++)
	{
		for(j=0;;j++)
			cin>>a[i][j];
		b[i]=j;
		a[i][j+1]='\0';
	}
	cin.getline(a[n-1],100);
	b[n-1]=strlen(a[n-1]);*/
	int l;

	l=b[0];
	cout<<a[0];
	for(i=1;i<n-1;i++)
	{
		l=l+1+b[i];
		if(l>80)
		{
			cout<<endl;cout<<a[i];l=b[i];
		}
		else
		{
			cout<<' '<<a[i];
		}
	}
	l=l+1+b[n-1];
	if(l<=80)
		cout<<' '<<a[n-1];
	else
	{
		cout<<endl;
		cout<<a[n-1];}
	return 0;
		

}
int main()
{
	char a[1000][50];
	int n,i;
	cin>>n;
	for(i=1;i<=n;i++)
		cin>>*(a+i);
	int e=1;
	int len=0;
	for(i=1;i<=n;i++)
	{
		if(e)
		{
			cout<<*(a+i);
			e=0;
			len=strlen(*(a+i))+1;
		}
		else
		{
			if((len+strlen(*(a+i)))>80)
			{
				cout<<endl;
				len=0;
				i--;
				e=1;
			}
			else
			{
				cout<<' '<<*(a+i);
				len+=strlen(*(a+i))+1;
			}
		}
	}
	return 0;
}
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;
	cin>>n;
	char a[500][41];
	int b[500];
	int i,j,sum=0,k=0;
	char (*p)[41]=a;
	int *q=b;
	for(i=0;i<n;i++)
		cin>>*(p+i);
	for(i=0;i<n;i++)
		*(q+i)=strlen(*(p+i))+1;
	for(i=0;i<n;i++){
		sum=sum+*(q+i);
		if(sum>81){
			for(j=k;j<i-1;j++){
				cout<<*(p+j)<<' ';
			}cout<<*(p+i-1)<<endl;
			sum=*(q+i);
			k=i;
		}
	}
	for(j=k;j<n-1;j++){
		cout<<*(p+j)<<' ';
	}cout<<*(p+n-1)<<endl;
	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);          //&Ecirc;&auml;&Egrave;&euml;&Ograve;&raquo;&cedil;&ouml;&micro;&yen;&acute;&Ecirc;&pound;&not;&frac14;&Ccedil;&Acirc;&frac14;&sup3;¤&para;&Egrave;
		if(num+1+linelen>80)    //&Egrave;&ccedil;&sup1;&ucirc;&Otilde;&acirc;&cedil;&ouml;&micro;&yen;&acute;&Ecirc;&micro;&Auml;&sup3;¤&para;&Egrave;&frac14;&Oacute;&Eacute;&Iuml;&Ccedil;°&Atilde;&aelig;×&Ouml;·&ucirc;&acute;&reg;&sup3;¤&para;&Egrave;&acute;ó&Oacute;&Uacute;80&micro;&Auml;&raquo;°
		{
			cout<<endl<<a;  //&Iuml;&Acirc;&Ograve;&raquo;&Ntilde;ù&Ecirc;&auml;&sup3;&ouml;&Otilde;&acirc;&cedil;&ouml;&micro;&yen;&acute;&Ecirc;
			linelen=num;         //&sup2;&cent;&Ccedil;&Ograve;&Ouml;&Oslash;&Ouml;&Atilde;&Iuml;&Acirc;&Ograve;&raquo;&ETH;&ETH;&micro;&yen;&acute;&Ecirc;&sup3;¤&para;&Egrave;
		}
		else
		{
			if(linelen !=0){
				linelen+=num+1;
				cout<<" ";
			}
			else{
				linelen=num;
			}
			cout<<a;   //&Ecirc;&auml;&sup3;&ouml;&cedil;&Auml;&micro;&yen;&acute;&Ecirc;+&iquest;&Otilde;&cedil;&ntilde;
		}
	}
	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,f,w=0;
    int m[300];
    int a[300][300];
    cin >>n;
    getchar ();
    for (int i=1;i<=n;i++)
    {
        for (int j=1;j<=299;j++)
        {
            *(*(a+i)+j)=getchar ();
            if (*(*(a+i)+j)==32||*(*(a+i)+j)==10)
            {
                *(m+i)=j-1;
                break;
            }
        }
    }
    while (w<n)//w???????????
    {
		f=0;
		while (1)
        {
			f=f+*(m+w+1);
			w++;
			for (int i=1;i<=*(m+w);i++)
			putchar (*(*(a+w)+i));
			if (w<n&&f+1+*(m+w+1)<=80)
            {
				putchar (32);
                f=f+1;
            }
			else
			break;
        }
		putchar (10);
	}
    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 m=0,i=0,j=0,k=0;
	cin>>m;
	int b[1000]={0},c=0;
	char a[1000][40];//??????
	for(i=0;i<m;i++)    //??????????????????
		cin>>a[i];
	for(i=0;i<m;i++)    //????????????
		for(j=0;;j++)
		{
			if(a[i][j]!='\0')
				b[i]++;
			else 
				break;
		}
	i=0;
	for(i=0;i<m;i++)//?k???????
	{
		k=k+b[i]+1;//??????
		
		if(k>81)//??k??80????
		{
			for(j=c;j<i-1;j++)
				cout<<a[j]<<" ";
			cout<<a[j]<<endl;
				k=0;c=i;i--;
		}
	}
	for(j=c;j<i-1;j++)
		cout<<a[j]<<" ";
	cout<<a[j]<<endl;
	
	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()
{
    char a[500][45];
    int n,i,q=0;
    cin>>n;
    for(i=0;i<=n-1;i++)
    {
                       cin>>*(a+i);
    
    }
    for(i=0;i<=n-1;i++)
    {
                       if(q+strlen(*(a+i))+strlen(*(a+i+1))+1>80)
                       {cout<<*(a+i)<<endl;
                       q=0;
                       }
                       else if(i==n-1) 
                       {cout<<*(a+i);
                       q=q+strlen(*(a+i))+1;
                       }
                       else{cout<<*(a+i)<<" ";
                       q=q+strlen(*(a+i))+1;
                       }
                            
    }
    return 0;
}
/*
 * 73.cpp
 * ??????
 *  Created on: 2011-12-3
 * ?????????????????????????????????????????????80?????????????????????????????????????????????????????
 */


int main()
{
	char n[10];
	cin.getline(n,10);
	char word[10000];
	cin.getline(word,10000);
    int i,j,t=1;
    while(t==1)
    {
    	for(i=0;i<10000;i++)//??????
    	{
    		if(word[i]=='\0') break;
    	}
    	if(i<80)//???80????????????
    	{
    		cout<<word<<endl;
    		t=0;
    		break;
    	}
    	else
    	{
    		for(i=80;i>40;i--)//??81??????
    		{
    			if(word[i]==' ') break;
    		}
    		for(j=0;j<i;j++)//???????
    		{
    			cout<<word[j];
    		}
    		cout<<endl;
    		for(j=i+1;j<10000;j++)//??????
    		{
    			word[j-i-1]=word[j];
    		}
    	}
    }
    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);
}
/*
 * h053_wenzi_paiban.cpp
 * name:????
 *  Created on: 2011-12-2
 *      Author: zhujile
 */
int main(){
	int n,i,row=0,len=0;       //n??????row???????????len??????????+1??????+1?
	char *p;                   //??????len??????
	cin>>n;
	getchar();                 //?????
	char a[n][42];             //?????????????
	for (i=0;i<n;i++)          //??n???
	{
		cin.get(a[i],42,' ');  //??????
		getchar();             //????
	}
	for (i=0;i<n;i++)          //?????
	{
		for (p=a[i];*p!='\0';p++,len++);//????????????????????
		if (row+len<80)                 //???????????
		{
		    if (row!=0)                 //???????????
		    	cout<<' ';              //???????
			for (p=a[i];*p!='\0';p++)   //?????
			    cout<<*p;
			if (row!=0)                 //???????????
				row+=(len+1);           //?????len+1
			else row+=len;              //????len
		}
		else                            //????80???
		{
			cout<<endl;                 //???
			row=0;                      //?????
			for (p=a[i];*p!='\0';p++)   //????
			    cout<<*p;
			row+=len;                   //???????
		}
		len=0;                          //?????
	}
	return 0;
}