semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
//============================================================================
// Name        : 1.cpp
// Author      : 
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================


int length=0;

void itype(char a[1000][50],int i)//?????
{
	int b=strlen(a[i]);//????
	if(length==0)//????????
		cout<<a[i];
	else if(length+b+1<=80)//?????
	{
		cout<<" "<<a[i];
		length++;
	}
	else//????
	{
		cout<<endl<<a[i];
		length=0;
	}
	length+=b;
}

int main() {
	int n;
	cin>>n;
	char character[1000][50];
	for(int i=0;i<n;i++)//?????
	{
		cin>>character[i];
		itype(character,i);
	}
	return 0;
}
int main()
{
	char str[500][41]={'\0'},s[500][81]={'\0'};
	int i,j=0,k,n,l[500]={0},len[500]={0};
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s",str[i]);
		l[i]=strlen(str[i]);
	}
	for(i=0;i<l[0];i++)
		s[0][i]=str[0][i];
	len[0]=l[0];
	for(i=1;i<n;i++){
		if(len[j]+l[i]<=79){
			s[j][len[j]]=' ';
			for(k=len[j]+1;k<=len[j]+l[i];k++)
				s[j][k]=str[i][k-len[j]-1];
			len[j]+=l[i]+1;
		}
		else {
			j++;
			for(k=0;k<l[i];k++)
				s[j][k]=str[i][k];
			len[j]=l[i];
		}
	}
	for(i=0;i<j+1;i++)
		printf("%s\n",s[i]);
	return 0;
}
int main()
{
	char a[50];
	int n;
	cin>>n;
	int i;
	int num=0;
	for(i=0;i<n;i++)
	{
		cin>>a;
		if(i==0)
		num=num+strlen(a);
		else
			num=num+1+strlen(a);
		if(num<=80)
		{
			if(i==0)
				cout<<a;
			else
			    cout<<" "<<a;
		}
		else
		{
			cout<<endl;
		    cout<<a;
		    num=strlen(a);
		}
	}
		return 0;
}
/********************************************
 *@file   2.cpp                             *
 *@author ??                              *
 *@date   2013-12-13                        *
 *@description                              *
 *??????12?????                  *
 ********************************************
 */
int main()
{
	int n, i, len, Count = 0;
	char ch[50];
	cin >> n;
	for (i = 0; i < n; i++)
	{
		cin >> ch;
		len = strlen(ch);
		Count = Count + len + 1;
		if (Count > 81)
		{
			cout << endl;
			cout << ch;
			Count = len + 1;
		}
		else
		{
			if (i == 0)
				cout << ch;
			else
				cout << ' ' << ch;
		}
	}
	return 0;
}
int main()
{
	int n,i,len=0,l;
	char word[64],p[64]="";
	cin >>n;//???????
	for(i=0;i<n;i++)
	{
		cout <<p;//
		cin >>word;//????
		l=strlen(word);//??????????
		if(len+l>80)// ???????80?
		{
			cout <<endl;//??
			len=0;//?????????
		}
		else if(i>0)
			cout<<" ";
		len+=l+1;
		strcpy(p,word);
	}
	cout <<p;
	return 0;
}
int main()
{
	int n , i;
	char word[500][40];
	
	cin >> n;
	cin.get();

	if(n > 1)
		for(i = 0; i < n - 1; i++)
			cin.getline(word[i] , 40 , ' ');

	cin.getline(word[n - 1] , 40);

	char (*p)[40] = word;
	int len = strlen(*p);

	cout << *p++;

	for(i = 1; i < n; i++)
	{
		len += strlen(*p) + 1;

		if(len > 80)
		{
			cout << endl;
			cout << *p;
			len = strlen(*p);
		}
		else
			cout << " " << *p;

		p++;
	}

	return 0;
}
int main()
{
    int n, count=0;
    char word[30];
    cin>>n;
    cin>>word;
    cout<<word;
    count=(int)strlen(word);
    n--;
    while (n--)
    {
        cin>>word;
        if (count+strlen(word)<80)
        {
            cout<<" "<<word;
            count=count+(int)strlen(word)+1;
            continue;
        }
        if (count+strlen(word)>=80)
        {
            cout<<endl<<word;
            count=(int)strlen(word);
        }
    }
    
    return 0;
}
main()
{
      char word[1000][50]={'\0'};
      int i,n,sum,len;
      scanf("%d",&n);
      
      for(i=0;i<n;i++)
          scanf("%s",word[i]);
      printf("%s",word[0]);
      sum=strlen(word[0]);
      for(i=1;i<n;i++)
      {
          len=strlen(word[i]);
          sum+=len+1;
          if(sum<=80)
          {
              printf(" %s",word[i]);
              
          }
          else
          {
              printf("\n");
              printf("%s",word[i]);
              sum=strlen(word[i]);
          }
      }

}
int main()
{
	int n=0,num=0,i=0;
	char a[10000]={'\0'},*p=a;
	cin>>n;
	cin.get();
	char c=getchar();
	while(c!='\n')
	{
		*p++=c;
		num++;
		c=getchar();
	}
	p=a+80;
	while(*p!='\0')
	{
		while(*p != ' ' && p < a+num-1)
		{
			p-- ;
		}
		*p = '\n';
		//while(*p!=' ')
		//{
		//	p--;
		//	if(*p==' ')
		//	{
		//		*p='\n';
		//	}
		//}
		p=p+81;
	}
	p = a+num-1;
	while(*p == ' ')
	{
		*p = '\0';
		p --;
	}
	//bool m=true;
	//for(p=a+num-1;p>=a;p--)
	//{
	//	if(m==true && *p==' ')
	//	{
	//		*p='\0';
	//	}
	//	else if(*p!=' ')
	//	{
	//		m=false;
	//	}
	//}
	for(p=a;*p!='\0';p++)
		cout<<*p;
	return 0;
}
//
//  main.cpp
//  test
//
//  Created by ??? on 12-12-23.
//  Copyright (c) 2012? ???. All rights reserved.
//



    int main() {
        int n, i, wl, len = 0,line=0;
        char w[64];
        scanf("%d", &n);
        for (int i=1; i<=n; i++) {
            scanf("%s",w);
            wl=strlen(w);
            if (line==0) {
                printf("%s",w);
                len=wl;
                line++;
            }
            else if(len+wl+1<=80)
            {
                printf(" %s",w);
                len+=wl+1;
            }
            else if(len+wl+1>80)
            {
                printf("\n%s",w);
                len=wl;
            }
        }
        return 0;
    }
/*************************
 ***??:??? 1200012776
 ***????:????
 ***??:2012?12?7?
 *************************/
int main()
{
	char ch[2000] = {0}, *p = &ch[0], *q = NULL, *l = NULL, *k;
	int n, flag = 0;
	cin >> n;
	cin.get();
	cin.getline(ch, 2000);
	while (*p != 0)	//??
	{
		flag = 0;
		for (q = p; ;)	//??????????
		{
			for (l = q; *l != ' ' && *l != 0; l++);	//???????
			l--;
			if (l - p < 80)	//???????????80,????
			{
				if (flag == 1)	//?????????,????,?????
				{
					cout << " ";
				}
				for (k = q; k <= l; k++)
				{
					cout << *k;
					flag = 1;
				}
				q = l + 2;	//?q??l+2,???????
			}
			else
			{
				if (l - p != 79)
				{
					cout << endl;	//??????,??????
					break;
				}
			};
			if (*(l + 1) == 0)
			{
				q = l + 2;
				break;
			}
		}
		p = q;
	}
	return 0;
}
void judge(char s[],int *n,int *m)
{
	char *a,*b,word[40];
	int k=0;
	for(a=s+*n,b=word;*a!=' '&&*a!='\0';a++,b++)
	{
		k++;
		*b=*a;
	}
	*b='\0';
	if(k<80-*m+1)
	{
		if(*m!=1)
		{
			printf(" ");
		}
		printf("%s",word);
		*n=*n+k+1;
		*m=*m+k+1;
		if(*m>80)
		{
			printf("\n");
			*m=1;
		}
	}
	else
	{	
		if(k==80-*m+1)
		{
			printf(" ");
			printf("%s\n",word);
			*n=*n+k+1;
			*m=1;
		}
		else
		{
			printf("\n%s",word);
			*n=*n+k+1;
			*m=k+2;
		}
	}
}
int main()
{
	void judge(char s[],int *n,int *m);
	int n,now=0,line=1,i;
	int *all=&now,*current=&line;
	char para[2000],enter;
	scanf("%d%c",&n,&enter);
	gets(para);
	for(i=1;i<=n;i++)
	{
		judge(para,all,current);
	}
	return 0;
}
void main()
{
	int n,i,temp;
	char word[300][50]={0};

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

	i=0;
	temp=strlen(word[0])+1;
	while(i<n)
	{
		
			
			if(temp+strlen(word[i+1])<=80)
			{
				if(i==n-1)
                     printf("%s",word[i]);
				else
					printf("%s ",word[i]);
				i=i+1;
				temp=temp+strlen(word[i])+1;
			}
			else 
			{
            printf("%s\n",word[i]);
			i=i+1;
			temp=strlen(word[i])+1;
			}

	}
}
int main(){
    int n,i,k=0,M=-1,j;
	char a[1000][100];
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%s",a[i]);
	while(1){
		for(j=k;j<n;j++){
			M+=strlen(a[j])+1;
			if(j==k)
				printf("%s",a[j]);
			else if(M<81)
				printf(" %s",a[j]);
			else{
				printf("\n");
				M=-1;
				k=j;
				break;
			}
		}
		if(j==n)
			break;
	}
	return 0;
}
/*
 * 2.cpp
 *
 *  Created on: 2011-1-9
 *      Author: jsgl
 */
int main()
{
	char a[1000][41];
	int n, i, k=-1;
    cin>>n;
    for(i=0; i<n; i++)
	{
		cin>>*(a+i);
		if(k==-1) cout<<*(a+i);
		k=k+strlen(*(a+i))+1;
		if(k<=80&&k!=strlen(*(a+i)))
		{
			cout<<" "<<*(a+i);
		}
		else if(k>80)
		{
			cout<<endl;
			cout<<*(a+i);
			k=strlen(*(a+i));
		}
	}
	return 0;
}
int main()
{
    int n,c=0;
    scanf("%d",&n);
    char s[41];
    scanf("%s",s);
    printf("%s",s);
    n--;
    c=strlen(s)+1;
    while(n--)
    {
        scanf("%s",s);
        c+=strlen(s);
        if(c>80)
        {
            c=strlen(s)+1;
            printf("\n");
            printf("%s",s);
        }
        else
        {
            printf(" %s",s);
            c++;
        }
    }
}
char words[10000][50]={0};
int main()
{
//	freopen("in.in","r",stdin);
	int n;
	cin>>n;
	cin.get();
	int i=0;
	for (i = 0; i<n; i++)
		scanf("%s",words[i]);
	
	int count=0;
	int current=0;
	cout<<words[count];
	current=strlen(words[count]);
	count++;
	while(count<n)
	{
		if (current+strlen(words[count])+1 > 80)
		{
			cout<<endl<<words[count];
			current=strlen(words[count]);
		}
		else if (current+strlen(words[count])+1 == 80)
		{
			cout<<" "<<words[count]<<endl;
			current=0;
		}
		else if (current+strlen(words[count])+1 < 80)
		{
			if (current)
			{
				cout<<" ";
				current++;
			}
			cout<<words[count];
			current+=strlen(words[count]);
		}
		count++;
	}

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

	}
	for(i=k;i<n-1;i++)
		cout<<a[i]<<" ";
	cout<<a[n-1]<<endl;
	return 0;
}
int main()
{
	int n;                       //????????n
	cin>>n;
	char w[41];                  //?????????
	int l=0;                     //??l?????????
	cin>>w;                      //???????????????
	l=strlen(w);
	cout<<w;
	n--;
	while(n--)                   //?????????????????????80??????l????????l???????
	{
		cin>>w;
		if(l+strlen(w)+1<=80)
		{
			l=l+strlen(w)+1;
			cout<<' '<<w;
		}
		else
		{
			l=strlen(w);
			cout<<endl<<w;
		}
	}
	return 0;
}
int main()
{
	int n,i,length=0;
	char word[41];
	scanf("%d\n",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s",&word);
		if(i==0)
			printf("%s",word),length=strlen(word);
		else
		{
				length+=(strlen(word)+1);
				if(length>80)
					printf("\n%s",word),length=strlen(word);
				else
					printf(" %s",word);
		}
	}
	return 0;
}
int main()
{
	int i,j,n,len,e=0;
	char word[NMAX][AMAX];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s",word[i]);
	}
	i=0;
	while(i<n){
		len=strlen(word[i]);
		for(;len<=80&&i<n;i++){
			len+=strlen(word[i+1])+1;
		}
		printf("%s",word[e]);
		for(j=e+1;j<i;j++)
			printf(" %s",word[j]);
		e=i;
		printf("\n");

	}

}
struct sz{
	char word[41];
}*p;
int main(int argc, char* argv[])
{
	int n,i,m,add=0;
	scanf("%d",&n);
	p=(struct sz *)malloc(sizeof(struct sz)*n);
	for(i=0;i<n;i++){
		scanf("%s",&(p+i)->word);
	}
	for(i=0;i<n;i++){
		m=strlen((p+i)->word);
		if(add+m<80){
			if(add>0){
				printf(" ");
				add++;
			}
			printf("%s",(p+i)->word);
			add+=m;
		}
		else{
		printf("\n%s",(p+i)->word);
		add=m;
		}
	}
	return 0;
}
int main() {
 int n;
 char str[80];
 cin>>n;
 int ln=0;
 while(n--) {
  cin>>str;
  if (ln == 0) {
   cout<<str;
   ln=strlen(str)+1; 
  }
  else if (ln+strlen(str)>80) {
   cout<<endl<<str;
   ln=strlen(str)+1;
  }
  else {
   cout<<' '<<str;
   ln += strlen(str)+1;
  }

 }
 return 0;
}
int main()
{
    int n, i, j, count;
    char a[50], b[50];
    scanf("%d", &n);
    scanf("%s", a);
    printf("%s", a);
    count=strlen(a);
    for(i=2; i<=n; i++)
    {
        scanf("%s", a);
        if(a[0]=='k')
            printf("");
        count=count+1+strlen(a);
        if(count<=80)
        {
            printf(" %s", a);
        }
        else
        {
            printf("\n%s", a);
            count=strlen(a);
        }
    }
    printf("\n");
    return 0;
}
int main()
{
    // FILE *flog = fopen("log.txt", "w"); 
    // for (int i = 0; i < 8; i++) printf("1234567890");
    // printf("\n");
    int n,i,l[300],line=0,f;
    char word[300][30];
    scanf("%d", &n);
    for(i=1;i<=n;i++){
                      scanf("%s", word[i]);
                      l[i]=strlen(word[i]);
                      }
    for(i=1;i<=n;i++){
                        f=0;
                        // fprintf(flog, "WORD (%d) %s = %d, NEXT (%d) %s = %d, LINE = %d\n", i, word[i], l[i], i + 1, word[i + 1], l[i + 1], line);
                        if(line+l[i]<=80)
                        {
                            printf("%s", word[i]);line+=l[i];
                            // fprintf(flog, "L = %d\n", line + l[i + 1] + 1); 
                            if(i != n && line+l[i+1]+1<=80){printf(" ");line+=1;f=1;}
                        }
                            // fprintf(flog, "F = %d\n", f); 
                        if(line>80||f==0)
                        {printf("\n");line=0;}
                        
                        
                    }
    // while(1);
    return 0; 
    }
int main()
{
	int a[81]={0},n=0,i=0;
	char s[45];
	int *p=&a[0],*q=&a[0];
	cin>>n;
	cin>>s;
	cout<<s;
	p=p+strlen(s);
	for(i=1;i<n;i++)
	{
	   cin>>s;
	   if(p+1+strlen(s)<=&a[80])
	   {
	   cout<<' '<<s;
	   p=p+1+strlen(s);
	   }
	   else
	   {
	   cout<<endl;
	   cout<<s;
	   p=q+strlen(s);
	   }
	}
	return 0;
}
main()
{
	char p[1000][30];
	int i,n=0;
	int sum[1000];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s",p[i]);
		sum[i]=strlen(p[i]);
	}
	int count=0;
	for(i=0;i<n;i++)
	{
		if(count==0)
		{
			printf("%s",p[i]);
			count=count+sum[i];
		}
		else if(count+sum[i]<80)
		{
			printf(" %s",p[i]);
			count=count+sum[i]+1;
		}
		else if(count+sum[i]>=80)
		{
			printf("\n");
			count=sum[i];
			printf("%s",p[i]);
		}
	}
}
int n=0,len[1001]={0},sum=0;
char str[1001][101]={0};
void f(int start)
{
	int sum=0,k=0;
	if(start>n)
	{
	}
	else
	{
		cout<<str[start];
		sum=strlen(str[start]);
		for(k=start+1;k<=n;k++)
		{
			if((sum+len[k])<80)
			{
				sum+=len[k]+1;
				cout<<" "<<str[k];
			}
			else
			{
				break;
			}
		}
		start=k;
		cout<<endl;
		f(start);
	}
}
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>str[i];
		len[i]=strlen(str[i]);
	}
	f(1);
	return 0;
}
int main(){
	int i,j,k,n,m,sum=0;
	char a[1000][40]={0},*p;
	scanf("%d",&n);
	for(i=0;i<=n;i++){
		scanf("%s",a[i]);
	}
         sum+=strlen(a[0]);
         printf("%s",a[0]);
	for(p=a[0]+40;p<a[0]+n*40;p+=40){
		if(strlen(p)+sum+1>80){
		   printf("\n%s",p);
                     sum =strlen(p);
                     continue;
		}
		printf(" %s",p);
                  sum+=strlen(p);
                  sum++;
	}
         printf("%s",p+40);
}
char a[1000][30];
int la[100] = {0};

int main()
{
	int n, i;
	char b[10000];
	cin >> n;
	cin.get();
	cin.getline(b, 10000);
	int lb = strlen(b);
	int p = 0, t = 1;
	for (i = 0; i <= lb - 1; i++)
	{
		if (b[i] == ' ')
		{
			t++;
			p = 0;
		}
		else
		{
			a[t][p] = b[i];
			p++;
		}
	}
	for (i = 1; i <= n; i++)
	{
		la[i] = strlen(a[i]);
	}
	int num = 0;
	for (i = 1; i <= n; i++)
	{
		cout << a[i];
		num = num + la[i];
		if ((num + 1 + la[i + 1] <= 80) && (i != n))
		{
			cout << " ";
			num++;
		}
		else
		{
			cout << endl;
			num = 0;
		}
	}
	return 0;
}
int main()
{
	char word[300][41];
	int n, i, num[300] = {0}, *p, total = 0;
	cin >> n;
	p = num;
	for (i = 0; i < n; i++)
	{
		cin >> word[i];
		for (*(p + i) = 0; *(p + i) < 41; *(p + i) = *(p + i) + 1)
			if (word[i][*(p + i)] == '\0')
				break;
	}
	for (i = 0; i < n; i++)
	{
		if (total == 0)
		{
			total = *(p + i);
			cout << word[i];
		}
		else
		{
			total = total + *(p + i) + 1;
			if (total <= 80)
				cout << ' ' << word[i];
			else
			{
				total = *(p + i);
				cout << endl;
				cout << word[i];
			}
		}
	}
	return 0;
}
int main()
{
    int n, i, l, j, num = 0;
    char ch[45], *p;
    
    cin >> n;
    
    for(i = 0; i < n; i++)
    {
        cin >> ch;
        l = strlen(ch);
        p = ch;
        
        if(num == 0)
        {
            for(j = 0; j < l; j++)
            {
                cout << *p++;
                num++;
            }
        }
            
        else if(num > 0 && num + l + 1 <=80)
        {
            cout << " ";
            num++;
                
            for(j = 0; j < l; j++)
            {
                cout << *p++;
                num++;
            }
        }
            
        else if(num > 0 && num + 1 + l > 80)
        {
            cout << endl;
            num = l;
            for(j = 0; j < l; j++)
            {
                cout << *p++;
            }
        }
    }
    
    return 0;
}
char c[10000][100];///??
int count (char a[])///??????????
{
	int num=0;
	while (a[num]!='\0')
	{
		num++;
	}
	return (num);
}
int main ()
{
	int i,j,k=0,l=0,n,m;
	cin>>n ;
	int b[10000];///??????
	for (i=0;i<n;i++)
	{
		cin>>c[i];
		b[i]=count (c[i]);
	}
	while (k<n-1)///??
	{
		l=0;
		while (l+b[k]+b[k+1]+1<=80)
		{
			cout <<c[k];
			cout <<' ';
			l=l+b[k];
			k++;
			l++;
			if (k==n-1)break;
		}
		if (k==n-1)break;
		cout <<c[k] <<endl;
		k++;
		l++;
		//cout <<l<<endl;
	}
	if (l+b[n-1]<=80)
	cout <<c[n-1] <<endl;
	return (0);
}
int main(){
	int n,i;
	char inp[500][50];
	int len[500];
	cin>>n;
	for(i=0;i<n;i++)
	{
		cin>>inp[i];
		len[i]=strlen(inp[i]);
	}
	int l=80;
	for(i=0;i<n;i++)
	{
		if(l<len[i])
		{
			cout<<endl;
			l=80;
		}
		if(l!=80)
			cout<<" ";
		cout<<inp[i];
		l=l-1-len[i];
	}
	return 0;
}
//*???????**
//*????? 1300012893 **
//*???2013.12.15** 
int main()
{
	int m ;// ?????? 
    int i ,j ,k;
	cin >> m  ;//?????? 
	int b[m] ;// ??????????? 
	char a[m][40] ;//????????? 
	char (*p)[40] ;//????p??? a 
	p = a ;
    int *q ;//????q??? b 
    q = b ;	
    for( i = 0 ; i <= m - 1 ;i ++ )//???? 
            cin >> *(p + i) ;  
    for( i = 0; i<= m - 1 ;i ++)//?????? 
	        *(q + i ) = strlen(a[i]); 
    int c = 0 ;
    k = 0 ;
    p = a ;
    q = b ;
    for( i = 0 ; i < m ; i ++ ) //??????k???????? 
    { 
 			k = k + q[i] + 1 ;
			if( k > 81 )//????81????????????????????? 
            {
				for(j = c ; j < i - 1 ; j ++ )
					cout << *(p + j) << " ";
				    cout << *(p + j) << endl ;
				k = 0 ; //?????k?????????? 
                c = i ; //c??i 
                i --  ;//i?? 
			}
			else
	        {
                if( i == m - 1 )//???????????????81????? 
                {
                    for(j = c ; j < i  ; j ++ )
					cout << *(p + j) << " ";
				    cout << *(p + j) << endl ;
                }		
            }
    }
    return 0 ;

}
int main(){
	int n;
	cin>>n;
	char ch[100],ch1[44];
	cin>>ch1;
	cout<<ch1;
	int sum=strlen(ch1)+1;
	for(int i=1;i<n;i++){
		cin>>ch;
		sum=sum+strlen(ch)+1;
		if(sum>81){
			cout<<endl<<ch;
			sum=strlen(ch)+1;
		}
		else
			cout<<' '<<ch;
	}
	return 0;
}
/*
 * ????.cpp
 *
 *  Created on: 2011-12-10
 *      Author: llx
 */

int main()
{
	int i,num,length,sumlen=0;//i?????num??????length??????sumlen???????? 
	char word[41];//???? 
	cin>>num;
	for(i=0;i<num;i++)
		{
		cin>>word;
		length=strlen(word);
		if (sumlen!=0)
		{
                      sumlen=sumlen+length;//???????? 
                      if (sumlen<79)//????????80?? 
                      {
                                                             cout<<" "<<word;//??????? 
                                                             sumlen++;//????? 
                                                             continue;//????????? 
                      }
                      if ((sumlen==80)||(sumlen==79))//?????80 
                      {
                                                                    cout<<" "<<word<<endl;//?????? 
                                                                    sumlen=0;//?? 
                      }
                      if (sumlen>80)//????80 
                      {
                                                 cout<<endl<<word;//????? 
                                                 sumlen=length+1;;
                      }
		}
		else
		{
            cout<<word;
            sumlen=length+1;}
        }
		cin.get();cin.get();cin.get();cin.get();
	return 0;
}
void main()
{
	int n,i=-1,k=0,a[1000],p=0;
	char b[1000][42],c;
	scanf("%d",&n);
	while(i<n)
	{
	    
	c=getchar();	
		if(c==' '||c=='\n')
		{
			b[i][k]='\0';
			a[i]=strlen(b[i]);
			i=i+1;
			k=0;
			continue;}
b[i][k]=c;
		k=k+1;
		
	}

for(i=0;i<n;i++)
{
	p=p+1+a[i];

	if(p<81&&(p+a[i+1])<81&&i<n-1)
{printf("%s ",b[i]);}
else if(p=81&&i<n-1)
{
	printf("%s\n",b[i]);p=0;}
else if(p<81&&(p+a[i+1])>81&&i<n-1)
{
	printf("%s\n",b[i]);p=0;}
else if(i=n-1)
printf("%s\n",b[i]);

}

}
int main()
{
	
int i,j,k=0,l,m,n;
	
char word[40];
	
scanf("%d",&n);
	
scanf("%s",word);
	
k=k+strlen(word)+1;
	
printf("%s",word);
	
for(i=2;i<=n;i++)
	
{
	
	
scanf("%s",word);
	
	
k=k+strlen(word)+1;
	
	
if(k<=81) 
	
	
{
	
	
	
printf(" ");
	
	
	
printf("%s",word);
	
	
}
	
	
else
	
	
{
	
	
	
printf("\n%s",word);
	
	
   k=strlen(word)+1;
	
	
}
	
}
	
return 0;
}
int main()
{
	char c[2000];
	int l,n;
	scanf("%d\n",&n);
	gets(c);
	char *p1=c,*p2,*pointer=c;
	l=strlen(c);
	c[l]=' ';
	for(p2=c;p2<=&c[l];p2++)
	{
		if(*p2==32) break;
	}
	for(p2=(p2+1);p2<=&c[l];p2++)
	{
		if(*p2==32)
		{
			if(p2-pointer>80)
			{
				printf("\n");
				pointer=(p1+1);
				p1=(p1+1);
			}
			for(p1=p1;p1<p2;p1++) printf("%c",*p1);
		}
	}
	return 0;
}
/*1200012866 ???*/
int main(){
	int n;
	char a[50];
	cin>>n;
	cin>>a;
	int count=strlen(a)+1;	
	cout<<a;	
	for(int i=0;i<n-1;i++){
		cin>>a;
		if(count+strlen(a)<=80){
			cout<<' '<<a;
			count+=strlen(a)+1;
		}
		else{
			cout<<endl<<a;
			count=strlen(a)+1;
		}
	}

	return 0;
}
int main()
{
	int word_num,i,sum;
	char word[500][45];
	scanf("%d\n",&word_num);
	sum=0;
	for(i=0;i<word_num;i++)
	{
		scanf("%s",&word[i]);
	}
	for(i=0;i<word_num;i++)
	{
		if(sum==0)
		{
			printf("%s",word[i]);
			sum+=strlen(word[i]);
		}
		else
		{
			sum+=strlen(word[i])+1;
			if(sum<=80)
			{
				printf(" %s",word[i]);
			}
			else
			{
				sum=0;
				i--;
				printf("\n");
			}
		}
	}
	return 0;
}
// ??????.cpp : ??????????????
//
int main()
{
	int n;
	cin>>n;
	char word[40];
	int num=0;
	while(cin>>word)
	{
		if((num+strlen(word)+1)<80)
		{
			if(num!=0) {cout<<' ';num=num+1;}
			cout<<word;
			num=num+strlen(word);
		}
		else if((num+strlen(word)+1)==80) {cout<<' '<<word<<endl;num=0;}
		else 
		{
			num=0;
			cout<<endl;
			cout<<word;
			num=num+strlen(word);
		}
		
	}

		return 0;
}
char a[40]={0},b[40]={0};
int num=0;
int linelen=0;
int main()
{
	int n,k,cnt=0;
	cin>>n;
	cin>>b;       //?&#63541;?????
	cout<<b;
	k=strlen(b);   //?????????
	linelen=k;     //?????
	while(true)
	{
		cin>>a;
		num=strlen(a);          //?&#63541;?????????
		if(linelen==0){    //?????    
				{
					cout<<endl<<a;
					cnt++;
					linelen=linelen+num;
				}
		}
		else{
			if(num+linelen+1>80){    //&#63537;??????????&#63325;??????????&#63325;??????80??		
				cout<<endl<<a;  //?????????
				cnt++;
				linelen=num;         //?&#63359;?????????
			}
			else{
				if(num+linelen+1==80){  //&#63537;??????
					cout<<" "<<a;   //?????+??
					cnt++;
					linelen=0;  //??&#63325;?????0
				}
				else{
						cout<<" "<<a;   //?????+??
						cnt++;
						linelen=linelen+num+1;  //??&#63325;?????&#63325;???+??+???
				}
			}
		if(cnt==n-1)
				break;
		}
	}
	return 0;
}
int main ()
{
	int n,m=0,i,j=0,k=0,h=0;
	double gl1,gl2,gl3,gl4;
	int a[100];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
		if(a[i]>=1&&a[i]<=18) m=m+1;
		if(a[i]>18&&a[i]<36) j=j+1;
		if(a[i]>35&&a[i]<61) k=k+1;
		if(a[i]>60) h=h+1;
	}
	gl1=(double)m/n*100;
	gl2=(double)j/n*100;
	gl3=(double)k/n*100;
	gl4=(double)h/n*100;
	printf("1-18: %.2lf%%\n",gl1);
	printf("19-35: %.2lf%%\n",gl2);
    printf("36-60: %.2lf%%\n",gl3);
    printf("60??: %.2lf%%\n",gl4);
    return 0;
}
void main()
{
	int n,a[100],i;
	double b[4]={0};
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
		if(a[i]<=18)
		{b[0]++;}
		else if(a[i]>=19 && a[i]<=35)
		{b[1]++;}
		else if(a[i]>=36 && a[i]<=60)
		{b[2]++;}
		else if(a[i]>=61)
		{b[3]++;}
	}
		printf("1-18: %.2f%%\n",b[0]/n*100);
		printf("19-35: %.2f%%\n",b[1]/n*100);
		printf("36-60: %.2f%%\n",b[2]/n*100);
		printf("60??: %.2f%%\n",b[3]/n*100);
}