semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main(){
	char sz[101],c[101];
	int n,k,len,m;
	gets(sz);
	len=strlen(sz);
	c[0]=sz[0];
	n=1;
	for(k=1;k<len;k++){
			if(sz[k-1]==' '&&sz[k]==' '){
				c[n]=0;
			}else{
				c[n]=sz[k];
				n++;
			}
	}
	for(m=0;m<n;m++){
                printf("%c",c[m]);
}
	return 0;
}
int main()
{
	int i,g;
	char a[100];
	gets(a);
	g=0;
	for(i=0;i<strlen(a);i++)
	{
		if(g==0)
		{
			if(a[i]!=' ') cout<<a[i];
			else{
				g=1;
				cout<<a[i];  //??????g??????????????
			}
		}
		else 
		{
			if(a[i]==' ')  continue;//????????????????????
			else{
				g=0;
				cout<<a[i];
			}
		}
	}
	cout<<endl;
	return 0;
}
int main()
{
	char danci[50][100];
	char sentence[101];
    int i, k, n, len;
    k=0; n=0;
	gets(sentence);
    len = strlen(sentence);
    for(i = 0; i < len; i++){
	    if(sentence[i] != ' '){
		   danci[n][k] =sentence[i];
		   k++;
		}
		else if(sentence[i] == ' '&&sentence[i-1] == ' ')
		{
			n=n;
			k=0;
		}
		else if(sentence[i]==' '&&sentence[i-1]!=' '){
		  danci[n][k] ='\0';
		  n++;
		  k= 0; 	
		}
}
danci[n][k] = '\0';
for(i=0;i<n;i++)
{
	printf("%s ",danci[i]);
}
printf("%s",danci[i]);

	return 0;
}
int main()
{
	/*char str[101];
	gets(str);
	int i, isfirst;
	for(i=0; str[i]!=NULL; i++)
	{
		if(str[i] != ' ')
		{
			printf("%c", str[i]);
			isfirst = 1;
		}
		else
		{
			if(isfirst)
			{
				printf(" ");
				isfirst = 0;
			}
		}
	}*/
	char str[101];
	gets(str);
	putchar(str[0]);
	int i;
	for(i=1; str[i]!=NULL; i++)
	{
		if(str[i] != ' ')
			putchar(str[i]);
		else if(str[i] != str[i-1])
			putchar(' ');
	}
	return 0;
}
int main(){
    char s[101],c[101];
    gets(s);
    c[0]=s[0];
    int i,j;
    for(i=1,j=1;s[i]!='\0';i++){
        if(s[i]!=' '){
            c[j]=s[i];
            j++;
        }else{
            if(s[i-1]!=' '){
                c[j]=s[i];
                j++;
            }
        }
    }
    c[j]='\0';
    printf("%s",c);
    return 0;
}
//************************
//*???????????*
//*??????          *
//*???1000012808      *
//************************
char str[100];
void space_clear(char *p);                                    //???????????????
int main()
{
	cin.getline(str,100);
	space_clear(str);                                         //????
	return 0;
}
void space_clear(char *p)                                     //??????????
{
	char *q, *s;
	while(1)
	{
		if(*p != ' ' && *p != '\0')
			p++;
		else
			break;
	}                                                        //?????????????
	if(*p == '\0')
		cout<<str<<endl;                                     //?????\0??????
	else
	{
		q = p;
	        while(1)
		{
			if(*q == ' ')
				q++;
			else
				break;
		}                                                   //??????????????????????
		s = p + 1;
		for(; *q != '\0'; )
			*s++ = *q++;                                    //????
		*s = '\0';                                          //???\0?????
		space_clear(p + 1);                                 //????
	}
}
int main()
{
	char a[105];
	cin.get(a,105,'\n');

	int len=strlen(a);
	int i=0;
	for(;i<101;i++)
	{
		int j;
		if(a[i]==' ' && a[i+1]==' ')
		{
			for(j=i+1;j<=len;j++)
				a[j]=a[j+1];
			len--;
			i--;
		};	
	}
	cout<<a<<endl;
	return 0;
}
int main()
{  
   char a[max+1],b[max+1];
   int i,j=0;
   gets(a);
   for(i=0;a[i]!='\0';i++){
       if(!(a[i]==' '&&a[i+1]==' ')){
       b[j++]=a[i];
    }
}
   b[j]='\0';
printf("%s",b);
return 0;
}
int main()
{
    char a[101];
    int i,t;
    gets(a);
    t=1;
    for(i=0;a[i]!='\0';i++)
    {	
	if(a[i]==' ')
	{
	    if(t==1)
	    {
		printf(" ");
		t++;
	    }
	}
	else
	{
	    printf("%c",a[i]);
	    t=1;
	}
    }
	return 0;
}
// ???????
int main()
{
	int i; // i????
	char a[101]; // ??a??????
	cin.getline(a, 101); // ????
	char *p = a; // ?????????
	for (i = 0; i < strlen(a); i++) 
	{
		if (a[i] == ' ' && a[i + 1] == ' ') // ????
			p++;
		else // ??????
			cout << *p++;
	}
	return 0;
}
int main(){
    char aa[100];
    gets(aa);
    int i,j;
    i=0;
    while(aa[i]!='\0'){
        j=0;
       if(aa[i]!=' '){
       cout<<aa[i];
       i++;
       }
       if(aa[i]==' '){
       cout<<" ";
         while(aa[i+j]==' ')
          j++;
          i=i+j;
          }
          }
          return 0;
          }
/*          ???????
??????        2010.12.12       */
int main()
{
	int count = 0;
	char a[1000] = {'\0'};
	char b[1000] = {'\0'};//b???????
	char *p = NULL;
	cin.getline(a,sizeof(a));//?????
	for(p = a; p < a + strlen(a); p++)
		if(*p != ' ')
		{
			*(b + count) = *p;
			count++;//???????????
		}
		else
			if(*(p - 1) != ' ')
			{
				*(b + count) = *p;
				count++;//????????
			}
	cout << b << endl;
	return 0;
}
int main()
{
    char a[101];
    int i,l,m;
    gets(a);
    l=strlen(a);
    printf("%c",a[0]); 
    for(i=1;i<l;i++)
    {
         if(a[i]!=' ') printf("%c",a[i]);
         else if(a[i]==' '&&a[i-1]!=' ') printf("%c",a[i]);
         else if(a[i]==' '&&a[i-1]==' ') continue;
    }
    getchar();
}
int main(){ 
 char aa[1024];
 char *p = NULL;
 memset(aa, 0x00, sizeof(aa));
 gets(aa);
 p = &aa[strlen(aa) - 1];
 while(' ' == *p--)
 {
  p[1] = '\0';
 }
 p = aa;
 while(' ' == *p++);
 p--;
 strcpy(aa, p);
 while(NULL != (p = strstr(aa, "  ")))
 {
  strcpy(p, &p[1]);
 }
printf("%s\n", aa);
 return 0;
}
int main()
{
	char str[100],*p=NULL;//?????????
	cin.get(str,100);//?????
	int l=strlen(str);//????
	p=str;//???
	for(int i=0;i<l;i++)
	{
		if(*(p+i)==' '&&*(p+i+1)==' ')//????
		{
			for(int j=i+1;j<l;j++)
			{
				*(p+j)=*(p+j+1);//???????
			}
			i=i-1;
		}
	}
	cout<<str<<endl;//?????????
	return 0;
}
/*
 * ???????.cpp
 *
 *  Created on: 2011-1-8
 *      Author: wangwei
 */
int main()
{
	char a[101];
	cin.getline(a,101);
	int i,j,l,p=0,q=0;
	l=strlen(a);
	for(i=0;i<l;i++)
		if(a[i]==' ')
		{
			p=0;
			for(j=i;i<=l;j++)
			{
				if(a[j]!=' ')
					break;
				p++;
			}
			for(j=i+1;j<=l;j++)
			{
				a[j]=a[j+p-1];
			    q++;
			}
		}
	a[l-q]='\0';
	cout<<a<<endl;
	return 0;
}
int main()
{
   char a[105];
   int i;
   gets(a);
   for(i=0;a[i]!='\0';i++){
       if(a[i]!=' '){
          printf("%c",a[i]);
       }else if((a[i]==' ')&&(a[i+1]!=' ')){
          printf(" ");
       }
    }
    return 0;
}
int main()
{
	char s[1000],d;
	int i,w=0,k,n,m,sd[1000];
	gets(s);
	n=strlen(s);
	for(i=0;i<n;i++)
		sd[i]=1;
	for (i=1;i<n;i++)
	{
		sd[i]=sd[i-1];
		if (s[i]==32)
			sd[i]--;
		if (s[i]!=32&&(sd[i-1]<=0))
			sd[i]=1;
	}
	for (i=0;i<n;i++)
	{if (sd[i]>=0)
		printf("%c",s[i]);
	}
}
main()
{
     int n;
     char a[100000];
     gets(a);
     n=strlen(a);
     int i,k;
     for(i=0;i<n;i++)
     {
       if(a[i]!=32) printf("%c",a[i]);
       else {
            if(a[i-1]!=32&&a[i+1]==32) {printf("%c",a[i]);}
            else if(a[i-1]!=32&&a[i+1]!=32) printf("%c",a[i]);
            }
      }
      getchar();getchar();
}
int main()
{
	char a[100];
	int i,s;
	gets(a);
	for (i=0;i<=99;i++)
	{
		if (a[i]=='\0') break;
		if (a[i]=='.') {printf(".");break;}
		if (a[i]!=' ') printf("%c",a[i]);
		else if (a[i-1]!=' ') printf(" ");
	}
	return 0;
}
int main()
{
	char str[200];
	cin.getline(str,200);
	int i,flag=1;
	for(i=0;str[i]!='\0';i++)
	{
		if(str[i]==' '&&flag==1)
		{
			cout<<str[i];
			flag=0;
		}
		else if(str[i]!=' ')
		{
			cout<<str[i];
			flag=1;
		}
		else ;
	}
	cout<<endl;
	return 0;
}
void main()
{
	int i,m,n,sum=0;
	char a[100];
	gets(a);
	for(i=0;*(a+i)!='\0';i++)
	{	
		if(*(a+i)==' '&&*(a+i+1)!=' ')printf("%c",*(a+i));
		if(*(a+i)!=' ')printf("%c",*(a+i));
	}
}
int main()
{
	char *se, a[100], n, i;
	cin.getline(a, 100);
    se = a;
	n = strlen(a);
	for(i = 0; *(se + i) != '\0'; i ++)
	{
		if(*(se + i - 1)== ' ' && *(se + i)== ' ')
		{
			strcpy(se + i, se + i + 1);
			i--;
		}
	}
	cout << se << endl;
	return 0;
}
int main()
{
	char a[101];
	memset(a, ' ', sizeof(a));
	int i = 0, n;
	while((a[i] = cin.get()) != '\n')
	{
		i++;
	}
	n = i + 1;
	for(i = 0 ; i < n ; i++)
	{
		if(a[i] != ' ' || (a[i] == ' ' && a[i + 1] != ' '))
		{
			cout << a[i] ;
		}
	}
	return 0;
}
int main()
{
    
    char op[104];
   gets(op);
  // printf("%s",op);
  int len;
  
  len=strlen(op);
   char opp[103];
   int j=0;
   for(int i=0;i<=len-1;i++)
   {
           if(op[i]!=32||(op[i]==32&&op[i+1]!=32)) {  opp[j]=op[i];  j++;}
           else
           { while(op[i]==32)   {i++;}
           i--;
           i--;}
           
           
           
           
   }
   
   opp[j]='\0';
   puts(opp);
   getchar();












}
void main()
{
	int i,j,k=0,n,m,r,len,sum=0,min,max,a[100]={0};
	char s[101]={""},s1[101][101]={""},b,c,d,e;
	gets(s);
	for(i=0,j=0;i<strlen(s);i++)
		if((s[i]==' '&&s[i+1]!=' '&&s[i-1]==' ')||(s[i]==' '&&s[i-1]!=' '&&s[i+1]==' ')) 
		a[j++]=i;
	//	printf("%d",a[0]);
	if(a[0]!=0)
	{
	  for(k=0;k<a[0];k++)
		  s1[0][k]=s[k];
	for(i=1;i<j/2;i++)
	  for(r=0,k=a[2*i-1]+1;k<=a[2*i]-1;r++,k++)
		  s1[i][r]=s[k];
	   for(r=0,k=a[2*i-1]+1;k<strlen(s);r++,k++)
	  s1[i][r]=s[k];
   printf("%s",s1[0]);
	for(i=1;i<j/2+1;i++)
	printf(" %s",s1[i]);
	}
   else for(i=0;i<strlen(s);i++)printf("%c",s[i]);
}
int main()
{
	int l,t=0,i,j;
	char a[101]={0};
	gets(a);
	l=strlen(a);
	for(i=0;i<l;i++)
	{
		if (a[i]==' ')
		{
			if(t==1)
			{
				for (j=i;j<l;j++)
					a[j]=a[j+1];
				i=i-1;
			}
			t=1;
		}
		else t=0;
	}
	printf("%s",a);
}
main()
{
      char a[101];
      char b[101];
      int i;
      int j;
      int count=1;
      int c;
      gets(a);
      c=strlen(a);
      for(i=0;i<101;i++)
      b[i]=' ';
      b[0]=a[0];
      for(i=1;i<c;i++)
      {
      if((a[i]==' ')&&(a[i-1]==' '))
      j=0; 
      else
      {
      b[count]=a[i];
      count++;
      }
      b[count]='\0';
      }
      printf("%s",b);
      getchar();
      getchar();
      }
int main() {
char a[101];
int i,n,b,j;
gets(a);
n=strlen(a);
for(i=0;i<n;i++){
if(a[i]==' '){
if(a[i+1]==' '){
continue;}else{printf("%c",a[i]);}
}else{printf("%c",a[i]);}}
return 0;
}
int main(){
    char jz[101],xg[101];
    gets(jz);
    int i,j,len;
    len=strlen(jz);
    for(i=0,j=0;i<len-1;i++){
        if(jz[i]!=' '){
            xg[j]=jz[i];
            j++;
        }else if(jz[i+1]!=' '){
            xg[j]=jz[i];
            j++;
        }
    }xg[j]=jz[len-1];
    for(int k=j+1;k<101;k++){
        xg[k]='\0';
    }
    puts(xg);
    return 0;
}
/**
 * ??????
 * ???1000012844
 * ??????????
 **/



int main()
{
	char str[ 101 ];
	
	gets( str );

	char *p = str;
	char *start = NULL, *end = NULL;

	for ( ; p < strlen( str ) + str; p++ )
	{
		if ( *p == ' '&& *( p-1 ) != ' ' )
		{
			start = p;
		}
		if ( *(p - 1 ) == ' ' && *p != ' ' )
		{
			end = p - 1;
		}

		if ( end > start )
		{
			p = start;
			while ( end < str + strlen( str ) )
			{
				*( ( start++ ) + 1 ) = *( ( end++ ) + 1 );
			}
		}
	}

	printf( str );
}
int main(){
    char a[101];
    gets(a);
    int i,k;
    for(i=0;a[i]!='\0';i++){
        if(a[i]==32&&a[i+1]==32){
            for(k=i;a[k]!='\0';k++){
            a[k+1]=a[k+2];
            }
        }
    }
        for(i=0;a[i]!='\0';i++){
        if(a[i]==32&&a[i+1]==32){
            for(k=i;a[k]!='\0';k++){
            a[k+1]=a[k+2];
            }
        }
    }
   for(i=0;a[i]!='\0';i++){
        if(a[i]==32&&a[i+1]==32){
            for(k=i;a[k]!='\0';k++){
            a[k+1]=a[k+2];
            }
        }
    }
       for(i=0;a[i]!='\0';i++){
        if(a[i]==32&&a[i+1]==32){
            for(k=i;a[k]!='\0';k++){
            a[k+1]=a[k+2];
            }
        }
    }
       for(i=0;a[i]!='\0';i++){
        if(a[i]==32&&a[i+1]==32){
            for(k=i;a[k]!='\0';k++){
            a[k+1]=a[k+2];
            }
        }
    }
       for(i=0;a[i]!='\0';i++){
        if(a[i]==32&&a[i+1]==32){
            for(k=i;a[k]!='\0';k++){
            a[k+1]=a[k+2];
            }
        }
    }
       for(i=0;a[i]!='\0';i++){
        if(a[i]==32&&a[i+1]==32){
            for(k=i;a[k]!='\0';k++){
            a[k+1]=a[k+2];
            }
        }
    }
       for(i=0;a[i]!='\0';i++){
        if(a[i]==32&&a[i+1]==32){
            for(k=i;a[k]!='\0';k++){
            a[k+1]=a[k+2];
            }
        }
    }
    puts(a);
    return 0;
}
int main(){
	char s[101];
	int i,k=0;
	gets(s);
	for(i=0;s[i]!='\0';i++){
		if(s[i]!=' '){
			s[k]=s[i];
			k++;
		}else if(s[i]==' '&&s[i-1]!=' '){
			s[k]=s[i];
			k++;
		}else if(s[i]==' '&&s[i-1]==' '){
			k+=0;
		}
	}
	s[k]='\0';
	puts(s);
	return 0;
}
//????????
//2010?11?23?
//1000012753 ???
int main()
{
	int len, count = 0, num;
	char str[200], *p = NULL;
	cin.getline(str, 200);
	len = strlen(str);
	for (p = str; p < str + len; ++p)
	{
		if (*p == ' ' && *(p + 1) == ' ')
		{
			num = 0;
			while (*(p + 1) == ' ')
			{
				p++;
				num++;
			}
			*(p - num + 1) = '\0';
			strcat(str, p + 1);
			len = len - num;
			p = p - num;
		}
	}
	cout << str << endl;
	return 0;
}
//???????



int main()
{
	char input[101];									//?????????
	char *p, *q;										//?????????
	int end;											//?????

	cin.getline(input, 102);

	end = strlen(input);								//???
	p = input;
	q = input;

	while(p < input + end)								//?????
	{
		while(*p != ' ' && *p != '\0')					//???????????????
			*(q++) = *(p++);							//????????????

		if(p == input + end)
			break;										//???

		//??????????
		*(q++) = *(p++);

		while(*p == ' ')
			p++;										//???????
	}

	*q = '\0';											//?????

	cout << input << endl;

	return 0;
}
int main()
{
    char sentence[100],word[100][100];   //sentence???????word???????? 
    int i=0,j=0,k=0;    //???? 
    
    cin.getline(sentence,100);       //?? 
    
    
    for(i=0;i<strlen(sentence);i++)     //???????????? 
    {        
       if(sentence[i]==' ') continue;            //???? 
       if(sentence[i]!=' '&&sentence[i-1]==' ')  //?????????????? 
         {j++;k=0;}                             //??????word?? 
       word[j][k]=sentence[i];
       k++;
    }
    
    
    cout<<word[0];
    for(i=1;i<=j;i++)       //?? 
    cout<<" "<<word[i];
    
        return 0;
    }
int main()
{
    char s[102],t;
    gets(s);
    int i,j,k,a,b,c;
    b=strlen(s);
    int n=0;
    for(k=0;k<b;k++)
    {
    for(i=2;i<b;i++)
    {
                     if(s[i-1]==' ')
                     {
                             if(s[i]==' ')
                             {
                                        for(j=i;j<b-1;j++)
                                        {
                                                          s[j]=s[j+1];
                                        }
                                                           n++;
                                                          s[b-n]='\0'; 
                                        
                             }
                     }
    }
    }
    printf("%s",s);
    getchar();
    }
/**
 * ???????????.cpp
 * ?????????????
 * ??????
 * ???2010.12.10
 */

int main()
{
	char sen[101];          //sen??????
	char *p = NULL, *q = NULL;
	int i, num1, len;  //num1???????????????,len????????
	len = 0;        
	cin.getline(sen,101);   //??????
	p = sen;    //??p??????????
	for (i = 1; *++p != '\0'; i++)
		if (*p == ' ')  //???????
		{
			if(*(p-1) != ' ')   //?????????????
				num1 = i;  
			if (*(p+1) != ' ')  //???????????
			{
				for (q = sen + num1; *(q + i - num1) != '\0'; q++)   //?????????????
					*q = *(q + i - num1);
				*q = *(q + i - num1);
				p -= i - num1;   //p????????
				len += i - num1;  //??len
				i -= i - num1;
			}
		}
	for (p = sen; p<i + sen; p++)  //??????????????
		cout << *p;
	cout << endl;
	
	return 0;
}
int main()
{
	char m[1000];
	int i,flag=0,len;
	cin.getline(m,1000);
	len=strlen(m);
	for(i=0;m[i]!='\0';i++)
	{
		if(m[i]==' ')
		{
			if(flag==0)
			{
				continue;
			}
			else
			{
				flag=0;
				cout<<m[i];
			}
		}
		else
		{
			flag=1;
			cout<<m[i];
		}
	}
	cout<<endl;
	return 0;
}
/**
  *file  ???????
  *author ???
  *date   12.7
  *function		???????????????????????????????????
*/
int main()
{
	char a[100],*p = NULL, *q = NULL;
	int lena, spacenum, deletenum = 0;
	cin.getline(a,100);
	lena = strlen(a);
	for(p = a; p < a + lena; p++)
	{
		if(*p != ' ')
		{
			spacenum = 0;
		}
		else
		{
			spacenum++;
			if(spacenum > 1)
			{
				deletenum++;
				for(q = p; q < a + lena - deletenum; q++)
				{
					*q = *(q+1);
				}
				p--;
			}
		}
	}
	for(p = a; p < a + lena - deletenum; p++)
	{
		cout << *p;
	}
	cout << endl;
	return 0;
}
main()
{
   int i,j,k=0,l;
   char a[100],b[100];
   gets(a);
   l=strlen(a);
   for(i=0;i<l;i++)
   {
    if(a[i]!=' ')
   {b[k]=a[i];
   k++;}
    else
    {   j=i;
        b[k]=' ';
        k++;
        while(a[j]==' ')
     j++;
     i=j-1;
     }
     b[k+1]='\0';
     }
   puts(b);
   getchar();
   getchar();
   getchar();
}
int main()
{
	char a[101];
	int i;
	gets(a);
	for(i=0;i<strlen(a)-1;i++)
	{
		if(a[i]!=' ')
		{
			printf("%c",a[i]);
		}
		if(a[i]==' ' && a[i+1]!=' ')
		{
			printf("%c",a[i]);
		}
	}
	printf("%c",a[strlen(a)-1]);
	return 0;
}
int main(){
    char a[100],z;
    int n,q,w,e;
    gets(a);
    n=strlen(a);
    for(int i=0;a[i]!='\0';i++){
        if(a[i]==' '){
           if(a[i-1]==' '){
            for(w=i;a[w]!='\0';w++){a[w]=a[w+1];}i--;
            } 
            }
        }
    puts(a);
    return 0;
}
int main()
{
	char a[105];
	for(int i=0;i<105;i++)
	{
		a[i]=' ';
	}
	cin.getline(a,105);
	int len;
	len=strlen(a);
	a[len]=' ';
	int count=0,c=0;
	for(int i=0;i<=len;i++)
	{
		char b[105];
		if(a[i]!=' ')
		{
			b[count]=a[i];
			count++;
		}
		if((a[i]==' ')&&(a[i-1]!=' '))
		{
			c++;
			if(c==1)
			{
				for(int j=0;j<count;j++)
				{
					cout<<b[j];
				}
			}
			else
			{
				cout<<" ";
				for(int j=0;j<count;j++)
				{
					cout<<b[j];
				}
			}
			for(int j=0;j<105;j++)
			{
				b[j]='\0';
			}
			count=0;
		}
	}
	return 0;
}
int main()
{
	char a[101];
	int b[101];
	int lenth,i;
	char c=' ';
	gets(a);
	lenth=strlen(a);
	for(i=0;i<lenth;i++)
	{
		b[i]=1;
	}
	for(i=0;i<lenth;i++)
	{
		if(a[i]==c&&a[i-1]==c)
			b[i]=0;
	}
	for(i=0;i<lenth;i++)
	{
		if(b[i]==1)
			printf("%c",a[i]);
	}
	return 0;
}
void filter(char *p)
{
	char *p1 = NULL;
	p1 = p;
	while (*p != 0)
	{
		while((*p != ' ') && (*p != 0))
		{
			
			*p1 = *p;
			cout << *p1;
			p1++;
			p++;
		}
		while ((*p == ' '))
		{
			p++;
		}
		if ((p - p1 > 0) && (*p != 0))
		{
			*p1++ = *(p - 1);
			cout << *(p1 - 1);
			//*p1 = *p;
			//cout << *p1<<2;
		}
	}
	cout << endl;
	//cout << *p << endl;
	//cout << p1 << endl;
	return;
}
int main()
{
	char str[105];
	cin.getline(str,105);
	filter(str);
//	cout << str << endl;

	return 0;
}
int main()
{
	char string[100];
	int n=0,m=0,len;
	cin.get(string,100,'\n');
	len=strlen(string);
	while(n<len)
	{
		if(string[n]==' ')
		{
			if(string[n-1]==' ')
			{
				len=len-1;
				for(int i=n;i<len;i++)
					string[i]=string[i+1];
				string[len]='\0';
				n--;
			}
		}
		n++;
	}
	cout<<string<<endl;
	return 0;
}
int main()
{
    int i,m;
    char a[1000];
    gets(a);
    m=0;
    for(i=0;a[i]!='\0';i++)
    {
        if(a[i]==' ')
        {
            if(a[i+1]==' ')
            {
                continue;
            }else{
                printf("%c",a[i]);
            }
        }else{
            printf("%c",a[i]);
        }
    }
    return 0;
}
// ???????????
 // ??????
 // ???2010?12?10?
 // ??????????


int main()
{
	char a[110];
	int n , i , j , g[110] = { 0 } ;
	cin.getline( a , 107 ) ;
	char *p = &a[0] ;
	n = strlen( a ) ;
	for ( i = 0 ; i <= n - 1 ; i++ )
	{
		if ( a[i] == ' ' && a[ i - 1 ] == ' ' )
		{
			g[i] = 1 ;
		}
		p = p +  1 ; 
	}
	for ( j = 0 ; j <= n - 1 ; j++ )
	{
		if ( g[j] == 0 )
			cout << a[j] ;
	}
	return 0;
}
int main()
{
	char word[100];
	int len, i;
	cin.getline(word, 100);
	len = strlen(word);
	for (i = 0; i < len; i++)
	{
		if (word[i] == ' ')
		{
			cout << " ";
			while (word[i] == ' ')
				i++;
		}
		cout << word[i];
	}
	return 0;
}
int main()
{
    char c;
    int i; 
    while((c=getchar())!='\n')
    {
        if(c!=' ')
        {
            cout<<c;
            i=0;
            continue;
        }
        while(c==' ')
        {
            i=i+1;
            if(i>=2) break;
            cout<<c;
        }
    }
    return 0;
}
int main()
{
	char x[101];
	int i,l,t,j,L;
	gets(x);
	l=strlen(x);
	t=0;
	L=l;
	for(i=0;i<l;i++){
		if(x[i]==' '){
			if(t==1){
				for(j=i;j<l-1;j++){
					x[j]=x[j+1];
				}
				L--;
				i--;
			}
			else{
				t=1;
			}
		}
		else{
			t=0;
		}
	}
	x[L]='\0';
	puts(x);
	return 0;
}
int main(){
   char s[N];
   gets(s);
   int i;
   
   for(i=0;s[i]!='\0';i++){
    
	   if(s[i]!=' '){printf("%c",s[i]);}   
       if(s[i]==' '&&s[i+1]!=' '){printf(" ");} 
   
   }

return 0;
}
int main()
{
	char str[200];
	int i;
	for(i=0;i<200;i++)
	{
		str[i]='a';
	}
	gets(str);
	for(i=0;i<strlen(str);i++)
	{
		if(str[i]!=' ')
		{
			cout<<str[i];
		}
		else
		{
			if(str[i+1]!=' ')
			{
				cout<<str[i];
			}
		}
	}
	cout<<endl;
	return 0;
}
int main()
{
	char *haha,sen[10000];
	int i=0,count;
	cin.getline(sen,10000);
    count=1;

	haha=sen;
	while(sen[i]!='\0')
	{
		
		if(sen[i]!=' ') 
		{
			count=0;
			cout<<*(haha+i);
		}
		else 
		{
			if(count==0) 
			{
				cout<<" ";
				count++;
			}

		}
		i++;
	}

	return 0;
}
//*************************************************************
//*                  ????????                         *
//*                  ?????1000010573                     *
//*                  ?????2010?12?                     *         
//*************************************************************

/*?? 
??????????????????????????????????? 
???? 
??????????????????????????100?
???? 
???????
???? 
Hello      world.This is    c language.
???? 
Hello world.This is c language. 
?? 
gets(char [] str)?????????????str 
*/

int main()               //??? 
{
    char str[111];//????? 
    int length = 0 , j = 0;
    char *p = NULL;
    cin.getline(str,111);//?????
    length = strlen(str);//????????????
	p=str;//?str?????p
	for(int i = 0 ; i<length ; i++)
	{
		str[i]=*p;//??,?????????????
		if(*p==' ')//??????????
		{
			if(*(p-1)==' ')//????????????????
			{//????????
				while(*p==' ')//while??????????????	
				{
					p++;
				}
				i--;
				continue;
			}
			else//?????????
			{	p++;   }//??????
		}
		else

		{p++;}//???????????????
    }
    printf("%s",str) ;
    return 0; 
}
int main(){
    char a[101],b[101];
    int i,n,k,j;
    gets(a);
    n=strlen(a);
    for(i=0,k=0;i<=n;i++){
        if(a[i]==' '&&a[i+1]==' '){
            continue;
    	}
        b[k]=a[i];
	    k=k+1;
    }
	puts(b);
    return 0;
}
int main()
{
	char Buffer[200] = {0} ;
	gets(Buffer) ;
	int count = 0;
	while (Buffer[count])
	{
		count ++ ;
	}
	for (int i = 0 ; i < count - 1 ; i ++)
	{
		if (Buffer[i] == ' ' && Buffer[i+1] != ' ')
		{
			cout<<Buffer[i];
		}
		else if (Buffer[i] != ' ')
		{
			cout<<Buffer[i];
		}
	}
	cout<<Buffer[count - 1]<<endl ;
	return 0;
}
int main()
{
    char str1[100];    //????? 
    cin.getline(str1,100);    //?????????? 
    for(int i=1;i<100;i++)     //??????? 
    {
            if(str1[i-1]==' '&&str1[i]==' ') //?????????????????????? 
            {
                          for(int j=i+1;j<100;j++)
                          {
                                  str1[j-1]=str1[j];
                          }
                          i--;      //??????? 
            }
    }
    cout<<str1<<endl; //????? 
    return 0;
}
int main(){
    int i,m;                 
    char zfc[1000],jg[1000];
    gets(zfc); 
    m=0;
    for(i = 0; zfc[i]!='\0'; i++){   
    	if(zfc[i]!=' '){
			jg[m]=zfc[i];
			m++;
		}else if(zfc[i]==' '&&zfc[i+1]!=' '){
			jg[m]=zfc[i];
			m++;
		}
	}
			jg[m]='\0';
			printf("%s\n",jg);
    return 0;
}
int main()
{
	int i,n,j,k;
	char str[100];
	
	gets(str);

	n=strlen(str);

	for(i=1;i<=n;i++){
		for(k=1;k<101;k++){
			if(str[i-1]==' '&&str[i]==' '){
			    for(j=i;j<n;j++){
				str[j]=str[j+1];
				}
			}
		}
	}

	printf("%s\n",str);

	return 0;
}
int main() {
  char str[110] ;
  int flag[110] ;
  memset(flag,1,sizeof(flag));
  gets(str);
  int len=strlen(str);
  int i;
  for(i=0; i<len-1;i++) { 
     if(str[i]==' ' && str[i+1]==' ')
       flag[i+1]=0 ;
  }
  for(i=0; i<len; i++)
     if(flag[i]!=0)
       printf("%c",str[i]);   
  return 1;
}
// ?????? ?? 1000062708
int main()
{
	char a[100000], *p;
	int i, f = 0;
	cin.getline(a,100000);
	for(p = a;*p != '\0';p++)
	{
		if(*p != ' ')
		{
			cout << *p;
			f = 0;
		}
		else if(f == 0)
		{
			cout << ' ' ;
			f = 1;
		}
	}
	return 0;
}