semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main(){
	char a[101];//??????
	cin.getline(a,101);//??
	int flag=0;//?????
	for(int i=0;i<strlen(a);i++)
	    {
		if(a[i]==' ') flag++;//?????flag??
		else {
			if(flag>1){
				for(int j=i;j<strlen(a);j++)
					a[j-flag+1]=a[j];//?????????
				for(int j=strlen(a)-flag+1;j<strlen(a);j++)
					a[j]='\0';  //?????????????
				}
				i=i-flag;//i????????flag?
			    flag=0;//flag??
			 }
		}
	cout<<a<<endl;//?????
	}
int main(){
	char zfc[100];
	gets(zfc);
	int n;
	n=strlen(zfc);
	int i;
	printf("%c",zfc[0]);
	for(i=1;i<n;i++){
		if(zfc[i]!=' '){
			printf("%c",zfc[i]);
		}else if(zfc[i]==' '&&zfc[i-1]!=' '){
			printf("%c",zfc[i]);
		}
	}
	return 0;
}
int main()
{
	char str[100 +1];
	int i , j , flag ,length ,l;
	flag = 0;

	gets(str);
	length = strlen(str);
	for(i = 0 ; i <= length - 1; i ++)
	{
		if(str[i] == ' ')
		{
			if(flag == 1)
			{
				for( j = i ; j <= length - 1 ; j ++)
					str[j - 1] = str[j];
				length --;
				i --;
			}
			else
				flag = 1;
		}
		else 
			flag = 0;
	}
	for(i = 0 ; i <= length - 1; i ++)
		printf("%c",str[i]);
	return 0;
}
int main()
{
	char a[101],b[101];
	int i,c;
	gets(a);
	c=strlen(a);
	for(i=0;i<c;i++)
	{
		if(a[i]!=' ')
			printf("%c",a[i]);
		else if(a[i-1]!=' ')
			printf(" ");
	}
	return 0;
}
int main()
{
	char blabla[5000];
	int len,i;
	gets(blabla);
	len=strlen(blabla);
	for(i=0;i<len;i++)
	{
		switch (blabla[i])
		{
		case ' ':
			if(i!=0&&blabla[i-1]!=' ')
				printf("%c",blabla[i]);
			break;
		default:
			printf("%c",blabla[i]);
			break;
		}
	}
	printf("\n");
	return 0;
}
int main()
{
char s[101],t[101];
int i,j=1,n;
gets(s);
t[0]=s[0];
for(i=1;s[i]!='\0';i++)
{
if(s[i]==' '&&s[i+1]==' ')
continue;
else

{
t[j]=s[i];j++;
}
}
t[j]='\0';
printf("%s",t);
return 0;
}
int main()
{
    char c[100];
    cin.getline(c,100);
    int n = strlen(c);
    int i = 0;
    do
    {
        if ( c[i] != ' ' )
        {
                cout << c[i] ;
                //cout << i << endl ;
                i++ ;
        }
        else
        {
            cout << c[i] ;
            do 
            {
                 i = i + 1 ;
            }while ( c[i] == ' ') ;
        }
    }while ( i <= n - 1) ;
    cout << endl ;
    return 0 ;
}
int main()
{
        char s1[256],s2[256];
        int n,l,i,j=0,k=0;
        gets(s1);
        l=strlen(s1);
        for(i=0;i<l;i++)
        {
                if (s1[i]!=' ')
                {
                        k=0;
                        s2[j]=s1[i];
                        j++;
                }
                else if (s1[i]==' '&&k==0)
                {
                        k=1;
                        s2[j]=s1[i];
                        j++;
                }
        }
        printf("%s",s2);
}
//* * * * * * * * * * * * * * * * * * * * * * * * 
//*???????????                       *
//*??????????? .cpp                  *
//*?????  1000012839                       *
//*???2010.12.09                             *
//* * * * * * * * * * * * * * * * * * * * * * * * 


int main()
{
	char str[101];
	char *p[100] = {NULL};
	int i, j, flag = 1;

	gets(str); 
	for (i = 0, j = 0; str[i] != '\0'; i++)
	{
		if (str[i] != ' ')
		{
			p[j] = &str[i];
			flag = 0;
			j++;
		}
		if (flag == 0 && str[i] == ' ')
		{
			p[j] = &str[i];
			flag = 1;
			j++;
		}
		
	}
	for (i = 0; i < j; i++)
		cout << *p[i];
	cout << endl;
	return 0;
}
void main()
{
  int p=0;
  char a='a';

  for(;a!='\n';) 
  {
	  scanf("%c",&a);
	  if(a!=' ')
	  {
		  printf("%c",a);
		  p=0;
	  }
	  else if(a==' '&&p==0)
	  {
		  p=1;
		  printf("%c",a);
	  }
	  else if(a==' '&&p==1) continue;
  }

}
//
//	?????	???????
//	?????	???????????????????????????????????
//	?????	?  ? ? ? ?? 1000012733 ?
//	?????	2010 ? 12 ? 10 ?
//
int main()
{
	char str[101];													//????????????????
	char *p;														//???????p?????????str????
	int i, len, j, k, count;										/*?????????????i?j??????len?????????????count???????
																	??????????????????*/
	cin.getline ( str, 101 );										//??????????str
	p = str;														//??p????????str????
	len = strlen ( str );											//?????????len
	for ( i = 0; i < len; i++ )										//??????????????????
	{
		if (( *( p + i ) == ' ' ) && ( *( p + i - 1 ) != ' ' ))		//????????????????????????????????????
		{
			k = i;													//k??????????????????
			count = 0;												//count??0
		}
		if (( *( p + i ) == ' ' ) && ( *( p + i - 1 ) == ' ' ))		//?????????????????????????????????????????????
		{
			count++;												//???????????count?1?????????????
		}
		if (( *( p + i ) != ' ' ) && ( *( p + i - 1 ) == ' ' ))		/*????????????????????????????????????????
																	??????????????????????*/
		{
			for ( j =i; j <= len; j++, k++ )					
			{
				*( p + k + 1 ) = *( p + j );						//??????????????'\0'????????
			}
			len = len - count;										//???????????????????????????????
			i = i - count;											//i?????????
		}
	}
	cout << p << endl;												//??????????
	return 0;
}
int main(){
	char str[101];
	gets(str);
	int len=strlen(str),i;
	for(i=0;i<len;i++)
	{
		if(str[i]==' '&&str[i+1]==' ')
			continue;
		else
			cout<<str[i];
	}
	cout<<endl;
	return 0;
}
int main()
{
    char str[100];
    for(int i=0;i<100;i++)
    {
            str[i]='\0';
    }                                    
    cin.get(str,100);             //???? 
    int i=0;int k=0;
    for(i=0;i<100;i++)
    {
         if(str[i]=='\0')
        { k=i;
         break;
         }else if(str[i]!=' ')
             continue;
         else{
                 for(int j=i;j<100;j++)
                 {
                     if(str[i+1]!=' ')
                     break;
             else{
                        for(int j=i;j<100;j++)  //????????????? 
                        {
                            str[j]=str[j+1];
                        }
                     }
                 }
             }
    }
    for(int i=0;i<k;i++)
    {
            cout<<str[i];
    }

    return 0;
}
int main()
{
	int i,j=0,k=0;
	char string[100],word[100][100];
	gets(string);
	for(i=0;i<strlen(string);i++)
	{
		if(string[i]!=' ')
		{
			word[j][k]=string[i];
			k++;
		}
		else 
		{
			word[j][k]='\0';
			if(string[i+1]!=' ')
		{
			j++;
			k=0;
		}
		}
	}
	word[j][k]='\0';
	for(i=0;i<j;i++)
	{
		printf("%s ",word[i]);
	}
	printf("%s\n",word[j]);
	return 0;
}
// ?????? ???1000010500 
// ??????? 
// 2010-12-8


int main()
{
    char str[100];
    char *p;
    int flag = 0;                                   // flag??????????? 
    gets(str);
    for (p = str;*p != '\0';p++)
    {
        if (*p == ' ' && flag == 0)                 // ????? 
        {
            flag = 1;
            continue;
        }
        if (*p == ' ' && flag == 1)                 // ????????????? 
        {
            *p = '1';                               // ????????? 
            continue;
        }
        if (*p != ' ')
            flag = 0;
    }
    for (p = str;*p != '\0';p++)
        if (*p != '1')
            cout << *p;
    return 0;
}
void main()
{
	int b=0,i;
	char c[100000];
	
	while(1){
		gets(c);
	for(i=0;i<100000;i++)
	{
		if(!c[i]) goto end;
		if(c[i]!=' '||b==0) putchar(c[i]);
		if(c[i]==' ') b=1;
		else b=0;
	}
	}
end:;
	printf("\n");
}
int main()
{    
	int i,n,j=0,k;
	char s[101];
	char a[101];
	gets(s);
	n=strlen(s);
	for(i=0;i<n;i++){
		if(s[i]!=' '){
			if(a[j]==' '){
				j++;
             a[j]=s[i];
			   j++;

			}else{
             a[j]=s[i];
			   j++;
			}
			
		}else{
			a[j]=' ';
			
		}
	}
	for(i=0;i<j;i++){

		printf("%c",a[i]);
	}
		return 0;
}
int main()
{
	int i;
	int j=0;
	char s[101];
	char d[101];
	gets(s);
	for(i=0;s[i-1];i++){
		if(s[i]==' '&&s[i+1]==' '){
			continue;
		}else {
		d[j]=s[i];
		j++;
		}
	}
	puts(d);
	return 0;
}
int main()
{
	char sen[110] , sen2[110];;
	int len , cnt = 0;
	cin.getline(sen,110);
	len = strlen(sen);
	for(int i = 0 ; i < len ; i++)
		if(sen[i] != ' ' || (sen[i] == ' ' && sen[i+1] != ' '))
		{
			sen2[cnt] = sen[i];
			cnt++;
		}
	for(int k = 0 ; k < cnt ; k++)
		cout << sen2[k];
	return 0;
}
int main()
{
	char words[200][30],input[10000];
	int len,i=0,j=0,k;
	gets(input);
	len = strlen(input);
	for(k = 0;k <= len;k++)
	{
		if(input[k] == ' ' )
		{
			if(j == 0)
				continue;
			words[i++][j] = '\0';
			j = 0;
		}
		else
			words[i][j++] = input[k];
	}
	for(k = 0;k <= i;k++)
	{
	if(k!=i)
	{printf("%s ",words[k]);}
	else
		printf("%s\n",words[k]);
	}
	return 0;
}
//******************************//
 //*     ?????				*//
 //*     ???1000012711		*//
 //*     ??????????	*//
 //*     ???2010.12.08		*//
 //******************************//
int main()
{
	char str[101], *pointer = str, l, g;
	gets(str);
	l = strlen(str);
	g = 1;
	for (; pointer < str + l; pointer++)
	{
		if (g == 1 && *pointer == ' ')
		{
			g = 0;
			cout << *pointer;
		}
		if (g == 0 && *pointer == ' ')
			continue;
		cout << *pointer;
		if (*pointer != ' ')
			g = 1;
	}
	cout << endl;
	return 0;
}
int main()
{
 int i,j,n;
 char a[200];
 gets(a);
 n=strlen(a);
 s:;
 for(i=0;i<n;i++){
   if(a[i]==' '&&a[i+1]==' '){
     for(j=i;j<=n;j++){
       a[j]=a[j+1];
     }
     n=n-1;
     goto s;
   }
 }
 puts(a);
 return 0;
}
int main()
{
  char str[100],tru[100];
  int i,j,t,counter;
  cin.getline(str,100);
  for(i=0,t=0;str[i]!='\0';i++,t++)
  {
    if(str[i]!=' ')
		tru[t]=str[i];
	else
	{   counter=0;
	    if(str[i+1]!=' ')
		    tru[t]=str[i];
		else
		{ 
		    for(j=i;str[j]==' ';j++)
			  counter++;
			tru[t]=str[i];
			i=i+counter-1;
		}
	}
  }
  tru[t]='\0';
  cout<<tru;
}
int main()
{
	char c[1000];
	int n,i,j,k;
	gets(c);
	n=strlen(c);
	for(i=0;i<n;i++)
	{
		if(c[i]!=' ') printf("%c",c[i]);
		else if(c[i]==' ') 
		{
			if(c[i-1]!=' ') printf(" ");
		}
	}
	scanf("%d",&i);
	return 0;
}
int main()
{
	char a[100];
	int flag[100];
	cin.getline(a,101);
	int i, j, n;
	for (i = 0; a[i] != '\0'; i++)
	{
		flag[i] = 1;
	}
	for (i = 0; a[i] != '\0'; i++)
	{
		if (a[i] == ' ' )
		{
			n = i;
			for (j = n + 1; a[j] == ' '; j++)
				if (a[j] == ' ')
					flag[j] = 0; 
			
		}
	}
	for (i = 0; a[i] != '\0'; i++)
		if (flag[i] == 1)
			cout << a[i];
	return 0;
}
int main(int argc, char* argv[])
{
    char a[101];
	int i=0;
	for (i=0;i<101;i++)
	{
		a[i]=='\0';
	}
	gets(a);
    i=0;
	while (a[i]!='\0')
	{
		if (!(a[i]==' ' && a[i+1]==' '))
		{
			printf("%c",a[i]);
		}
	    i++;
	}
	return 0;
}
int main ()
{
	char a[101] = {'\0'};
	cin.getline(a, 101);
	int len = strlen(a);
	for(int i = 0; i < len; i ++)
	if((a[i] != ' ') || ((a[i] == ' ') && (a[i+1] != ' ')))//?????????????????????
		cout << a[i];
	return 0;
}
int main()
{
	char a[101];
	cin.getline(a,101);
	int l = strlen(a);
	int flag = 1;
	for(int i = 0; i < l; i++)
	{
		
		if(a[i] != ' ') 
		{
			cout << a[i];
			flag = 0;
			continue;
		}
		else if(flag == 0) 
		{
			cout << a[i];
			flag = 1;
			continue;
		}
			else if(flag == 1) continue;
	}
	return 0;
}
int main()
{
	int i=0;
	int n=0;
	char a[100]={0};
	cin.getline(a,100,'\n');
	for(i=0;i<100;i++)
	{
		while(a[i]==' '&&a[i+1]==' ')
		{
			n=i;
			for(n=i;n<99;n++)
			{
				a[n]=a[n+1];
				a[99]=0;
			}
		}
	}
	cout<<a<<endl;
	return 0;
}
int main()//?????
{
	char a[100],word[50][10]={'\0'};
	int i,len,j,l[50],r[50],n;//????
	cin.getline(a,100);//??
	len=strlen(a);//???????
	j=1;//??
	l[0]=0;//??????????????a[0]
	for(i=1;i<len;i++)
		if(a[i-1]==' '&&a[i]!=' ')
		{
			l[j]=i;
			j=j+1;
		}//?j????????????a[l[j]]
	n=j-1;
	j=0;
	for(i=0;i<len-1;i++)
		if(a[i+1]==' '&&a[i]!=' ')
		{
			r[j]=i;
			j=j+1;
		}
	r[n]=len-1;//?j??????????????a[r[j]]
	for(i=0;i<=n;i++)
		for(j=l[i];j<=r[i];j++)
			word[i][j-l[i]]=a[j];//word[i]?a??i???
	cout<<word[0];
	for(i=1;i<=n;i++)
		cout<<" "<<word[i];//??
	return 0;
}//?????
void main()
{
	int len,i,j;
	char line1[101]={'\0'},line2[101]={'\0'};
	gets(line1);
	len=strlen(line1);
	for(i=0;line1[i]==' ';i++);
	line2[0]=line1[i];
	i++;
	for (j=0;i<len;i++)
	{
		if (line1[i]==' ' && line2[j]==' ')
			continue;
		else
		{
			j++;
			line2[j]=line1[i];
		}
	}
	len=strlen(line2);
	if (line2[len-1]==' ')
		line2[len-1]='\0';
	printf("%s",line2);
}
int main()
{
	int i=0;
	char *p,*m;
	char a[100];
	gets(a);
	m=a;
	p=a;
	while(a[i]!='\0')
	{
		if(a[i]==' ')
		{
			*p=' ';
			p++;
			while(a[i]==' ')
				i++;
			*p=a[i];
		}
		else
		{
			*p=a[i];
			p++;
			i++;
		}
	}
	*p='\0';
	cout<<m<<endl;
	return 0;
}
int main()
{
	int c;
	char getline[MAX];
	int i=0;
	int ex=IN;
	int line=0;
	while ((c=getchar())!='\n')
	{
		if (c!=' ')
		{
			ex=IN;
			getline[i]=c;
			++i;
		}
		else if ((c==' ')&&(ex==IN))
		{
			getline[i]=c;
			++i;
			ex=OUT;
		}
		else if ((c==' ')&&(ex==OUT))
			ex=OUT;		
	}
	getline[i] = 0;

	printf("%s", getline);

	//for (i=0;i<=line;++i)
		//putchar(getline[i]);
	
}
/*
 * 1.cpp
 *
 *  Created on: 2011-1-8
 *      Author: 10033
 */


int main(){
	char str[150];
	int i,j,nstr;
	cin.getline(str,150);
	nstr=strlen(str);
	for(i=0;i<nstr-1;i++)
		while(str[i]==' '&&str[i+1]==' ')
			for(j=i+1;j<nstr;j++)
				str[j]=str[j+1];
	cout<<str<<endl;
	return 0;
}
//??????????????????????????????????
//Goofy 2010 12 10
int main()
{
	char sen[length], *p=sen;
	int counter=0;
	gets(sen);
	while(*p != '\0')
	{
		if(*p != ' ')
		{
			cout<<*p;
			counter=0;
		}
		else if (counter==0)//?????
		{
			counter++;
			cout<<*p;
		}
		p++;
	}
	cout<<endl;
	return 0;
}
int main()
{
	int q,i;
	int k[100]={0};
	char str[100];
	gets(str);
	char *p=NULL;
	p=str;
	for(i=0;p[i];i++)
	{
		if(p[i]==' '&&p[i+1]==' ')
		{
			k[i+1]=1;
		}
		if(k[i]!=1)
		cout<<p[i];
	}
	
	
	cin>>q;
	return 0;
}
int main()
{
	char s[101];
	int l,i,j;
	cin.getline (s,101);
	l = strlen (s);
	for (i = 1;i <= l-1;i++)
	{
		if ((s[i] == ' ') && (s[i-1]== ' '))
		{
			for (j = i;j <= l-2;j++) 
				s[j]=s[j+1];
			l--;
			i--;
		}
	}
	for (i = 0;i <= l-1; i++)
		cout << s[i];
    return 0;
}
// ???????.cpp : ??????????????
//?????????~~

//#include "stdafx.h"

int main()
//int _tmain(int argc, _TCHAR* argv[])
{
	char a[100];
	char *pa[100];
	gets(a);
	int len=strlen(a),lpa=0,kk=0;//lpa??pa????kk??????????????
	for (int i=0;i<len;i++)
	{
		if (a[i]!=' ') //?????
			{				
				pa[lpa]=&a[i];
				lpa++;
				kk=0;
			}
		else
			if (kk==0)//????????
			{
				pa[lpa]=&a[i];
				lpa++;
				kk++;
			}
	}
	for(int i=0 ;i<lpa;i++)
		cout<<*pa[i];
	cout<<endl;
	return 0;
}
int main ()
{
	char str[100];
	char *p;
	int i,flag=0;
	cin.getline (str,100);
	for (i=0;i<strlen(str);i++)
	{
		p=str+i;
		if (*p==' ')
			flag++;
		else
			flag=0;
		if (flag==0||flag==1)
			cout << *p;
	}
	return 0;
}
int main()
{
	char str[100];
	int i=0,flag = 0;
	gets(str);
//	cout<<str;
	
	while(str[i]!='\0')
	{
		if(str[i]!=' ')
		{
			cout<<str[i];
			i++;
			continue;
		}
		if(str[i]==' '&&flag==0)
		{
			if(str[i+1]==' ')
				flag=1;
			cout<<str[i];
		}
		else
		{
			if(str[i]==' '&&flag==1)
			{
				if(str[i+1]!=' ')
					flag=0;
			}
		}
		i++;
	}
	cout<<endl;
	return 0;
}
int main()
{char a[150],b[150],s=0;
gets(a);
int l=strlen(a);
for (int i=0;i<=l-1;i++)
 {
  if (a[i]!=' '){s++;b[s]=i;}
  if (a[i]==' '){s++;b[s]=i;
  while (a[i+1]==' ')i++;}
 }
for (int i=1;i<=s;i++)
 {
  int j=b[i];cout<<a[j];
  //while (a[j]!=' '){j++;cout<<a[j];}
 }
return 0;
}
/**
 * 2.cpp
 * ?? ??
 * ?? 2011 11 29
 * ???????
 */
int main()
{
	char str[1000];
	char * p;
    cin.getline(str, 1000);
	p = str;
	
	
	while (*p != '\0') 

	{
		while ((*p != ' ') && (*p != '\0'))
		{
			cout << *p;
			p++;
		}

        if (*p == '\0')   // ???? ???????? ?????????p++???????????\0) 
			break;

		while ((*p == ' ') && (*p != '\0'))
			p++;

        if (*p == '\0')   // ???? ???????? ?????????p++???????????\0) 
			break;
		else cout << ' ';
	}
	return 0;
}

 //~                                                                                                  1.
//????????100?? ?????
//******************************************************************
//*?????????????.cpp                                  *
//*??????                                                    *
//*?????2010?11?19?                                        *
//*??????????????????                            *
//******************************************************************
int main()//???
{//?????
	char word[100];//?????
	int n=0;//??????
	int i=0;
	cin.getline(word,100,'\n');//?????
	n=strlen(word);//???????
	for(i=0;i<n;i++)//for??
	{//????
		if(word[i]==word[i-1]&&word[i-1]==' ')//?????????
		{
			continue;
		}
		if(word[i]=='\0')//??
			break;
		cout<<word[i];//?????
	}//????
	return 0;
}//?????
int main()
{
	char str[101],*p;
	gets(str);
	p=str;
	do
	{
		if (*p!=' ')
		{
			cout << *p;
			p++;
		}
		else
		{
			if (*(p+1)==' ')
				p++;
			else
			{
				cout << *p;
				p++;
			}
		}
	} while (*p!='\0');
	cout << endl;
	return 0;
}
int main()
{
	char str[101]={0},str1[101];
	int i,j,q;
	cin.getline(str,101);
		for(i=0,j=0; str[i]!='\0';)
			if(str[i]==' ')
			{
				if(str[i+1]==' ')
					i++;
				else
				{
					str1[j]=str[i];
				    i++;
					j++;
				}
			}
		
			else
			{
				str1[j]=str[i];
			    i++;
				j++;
			}
	    for(q=0;q<j;q++)
			cout<<str1[q];
		cout<<endl;
	  return 0;
}
void main()
{
    int i;
    char c[100];
    gets(c);
    for(i=0;c[i]!='\0';i++)
    {
        if(c[i]=='\t'&&c[i+1]!='\t'&&c[i+1]!=' ') printf(" ");
        else if((c[i]!=' '&&c[i]!='\t')||(c[i]==' '&&c[i+1]!=' '&&c[i+1]!='\t'))
        printf("%c",c[i]);
    }
}
int main()
{
	int i=0;
	char a[101]=" ";
	for(i=0;i<100;i++)
		cin.get(a[i]);
	for(i=0;i<100;i++)
	{
		if(((a[i]==' ')&&(a[i+1]!=' '))||(a[i]!=' '))
		cout<<a[i];
	}
	return 0;
}
int main(){
	int i;
	char c[101] = { 0 };
	cin.getline(c, 101, '\n');
	for (i = 0; i < strlen(c); i++) {
		if(c[i]!=' ') cout<<c[i];
		else{
		while (c[i]==' ') i++;
		cout<<" "<<c[i];
		}
	}return 0;
}
/************************/
/*    ???????    */
/*    ??? pyyaoer    */
/*   ??  2011.12.4    */
/************************/
int main()
{
	char c[1000];
	char *p=NULL;                  //?????
	p=c;
	gets(c);
	for (;*p!='\0';p++)            //???????????
	{
		if (*p==' ')               //?????????????
		{
			cout<<" ";
			for (;*p==' ';p++){}   //???????
			p--;
		}
		else cout<<*p;             //??????????
	}
	cout<<endl;
	return 0;
}
int main(){
	int i,n,m,j=0;
	char a[101],b[101];
	gets(a);
    n=strlen(a);
	for(i=0;i<n;i++){
		if(a[i]!=' '){
			b[j]=a[i];
			j=j+1;
		}else
            if(a[i]==' '&&a[i+1]!=' '){
				b[j]=a[i];
				j=j+1;
			}
	}
	for(i=0;i<j;i++){
		printf("%c",b[i]);
	}
	return 0;

}
//-----------------
//  ??????
//    Version 2.0
//     ???
//-----------------


int main()
{
	int i=0,j=0,blank=0,words=0,temp=0;          //i,j??, blank?????????,words?????
	char str[101];
	cin.get(str,101,'\n');  //????
	while(str[i]!='\0')
	{
		if(str[i]==' ') 
		{
			if(str[i-1]!=' ')
	    		words++;		
			 temp++;
			 str[i-blank+words-1]=str[i];
		}

        if(str[i]!=' '&&(blank!=words))
		{
			blank=blank+temp;
			temp=0;
			str[i-blank+words]=str[i];
		}
		i++;
	}
	str[i-blank+words]='\0';
	cout<<str;
	return 0;
}
int main()
{
    char string[100];
    gets(string);
    int i,j;
    int num;
    int count=0;
    num=strlen(string);
    for(i=1;i<num;i++)
    {
                    if(string[i]==' '&&string[i-1]==' ')
                    {
                                    for(j=i;j<num;j++)
                                    {
                                    string[j]=string[j+1];
                                    }
                                    count++;
                                    string[num-count]='\0';
                                    i=i-1;
                    }
                    
    }
    puts(string);                
    getchar();
    getchar();
    return 0;
    }
//****************************************************** 
//* ? ? ?   ?? ? ? ? ? ? ?                  *
//* ? ?      ?? ? ?                              *
//* ? ? ? ??2010 ? 12 ? 8 ?                    * 
//* ? ? ? ??? ? ? ? ? ? ?                  *
//* ? ?      ?1000010439                            *
//******************************************************
int main()
{
    char a[100];                               //??????? 
    int b,i;                                   //b???????? 
    char *p;                                   //?????????? 
    cin.getline(a,100);                        //????? 
    p = a;                                     //????????????? 
    b = strlen(a);
    for(;p<a+b;)
    {   
       if(*p ==' ')                            //?????? 
       {
          p++;                                 //???????? 
          if(*p != ' ')                        //???????,???????,??????????????????? 
          {
             cout << " " <<*p;
             p++;                              //???? 
          }
       }
       else                                    //??,?????? 
       {
          cout << *p;
          p++;
       }
    }
    return 0;
}
void main()
{
	int i,k,j;
	char a[101],*p[101];
	*p=a;

	gets(a);
	for(i=0;a[i]!='\0';i++)
	{
		if(a[i]==' ')
		{
			if(k==1)
			continue;
			
			else
			{
				printf("%c",a[i]);
				k=1;
			}
		}
		else
		{
			k=0;printf("%c",a[i]);
		}
	}
	
}
int main () {

int i,a;
int j=0;
char s[100],x[100];

gets(s);

a=strlen(s);

for(i=0;i<a;i++){
                 if(s[i]!=' '){x[j]=s[i];
                            j++;
                            }
                 else if ((s[i]==' ')&&(s[i-1]!=' ')){x[j]=s[i];
                            j++;
                            }
                 }
for(i=0;i<j;i++){
printf ("%c",x[i]);
}
return 0;    
}
int main()
{
    char str[122];
    gets(str);
    char *p=NULL;
    for(p=str;*p;p++)
    {
      if(*p==' ')
      {
         while(*p==' ')
          {
            p++;
          }
          p--;
          cout<<*p;
      }
      else cout<<*p;
    }
      int ss;cin>>ss; 
      return 0;
}
int main(){
	char l[102];
	int j,i,k;
	gets(l);
	for(k=0;k<100;k++){
	for(i=0;i<100;i++){
		if(l[i]==' '&&l[i+1]==' '){
			for(j=i;j<100;j++){
				l[j]=l[j+1];
			}
		}
	}
	}



	puts(l);
			
	return 0;
}
int main()
{
	char str[100][100];
	int i,j;
	for(i=0; ;i++)
	{
		cin>>str[i];
		if(cin.get()=='\n')
			break;
	}
	for(j=0;j<i;j++)
		cout<<str[j]<<" ";
	cout<<str[i];
	cout<<endl;
	return 0;
}
int main()
{
	int i,j=0,k,l;
	char a[101],b[101];
	gets(a);
	k=strlen(a);
	for(i=0;i<=k;i++)
	{
		if(a[i]==a[i+1]&&a[i]==' ')
		{
			continue;
		}
		else
		{
			b[j]=a[i];
			j++;
		}
	}

	puts(b);
	return 0;
}
int main()
{
    char str[102];
	char *p;
	p=str;
	gets(str);
	int c=strlen(str);
	for(p=str;p<str+c-1;p++ )
	{
	  if(*p==' '&&*(p+1)==' ')continue;               
	  if(*p==' '&&*(p+1)!=' '){cout<<' ';continue;}
	  if(*p!=' '){cout<<*p;}

	}
	cout<<*p;
	return 0;
}
int main()
{
    int i,j,n,a[100];char s[101];
    gets(s);
    n=strlen(s);
    for(i=0;i<n;i++)
    {
      if(s[i]==' '&&s[i+1]==' ')
      {
      for(j=i;j<n;j++) 
       s[j]=s[j+1];
        n--;
        s[n]='\0';
        i=0;
      }
      }
    puts(s);
    getchar();getchar();
}
int main()
{
	int n,i;
	char s[L];
	gets(s);
	n=strlen(s);
	for(i=0;i<n;i++){
		if(s[i]==32&&s[i+1]==32){
			for(i;i<n;i++){
				s[i]=s[i+1];
			}
			i=0;
		}
	}
	for(i=0;i<n;i++){
		if((s[i]=='.'&&s[i+1]=='d')||(s[i]=='c'&&s[i+1]=='d'))
			s[i+1]='\0';
         }
	printf("%s", s);
	return 0;
}
int main()
{
    char str[99];//??????
    gets(str);
    for(int i=0;i<strlen(str);i++)
       if(str[i]==32)//??????
		   while(str[i+1]==32)//????????
                             for(int k=i+1;k<strlen(str);k++)
			  str[k]=str[k+1];//??????????
    cout<<str;
    return 0;
}
int main()
{
	int i,k=0,n,p=1;
	char a[101],b[101];
	gets(a);
	for(i=0;a[i]!='\0';i++){
		if(a[i]!=' '){
			b[k]=a[i];
			k++;
			p=1;
		}else if(p!=0){
			b[k]=' ';
			k++;
			p=0;
		}
	}
	b[k]=0;
	printf("%s",b);
	return 0;
}
int main(int argc, char* argv[])
{
	char s[101],pre;
	int i;

	gets(s);
	pre='-';

	for(i=0;s[i]!='\0';i++)
	{
		if(s[i]!=' ') 
			printf("%c",s[i]);
		else if(pre!=' ')
			printf(" ");
		pre=s[i];
	}

	return 0;
}
int main()
{
	char zfc[101]={0};
	gets(zfc);
	char zfc2[101]={0};
	int n;
		int i=0;
	int j=0;
	n=strlen(zfc);
    for(i=0;i<n;i+=1)
	{if(zfc[i]!=' '){zfc2[j]=zfc[i];j+=1;}
	else if(zfc[i]==' '&&zfc[i+1]!=' '){zfc2[j]=' ';j+=1;}}



printf("%s\n",zfc2);
return 0;
}