semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
main()
{	int n,i,j,k;
	char *p,*pp;
	p=(char*)calloc(num,sizeof(char));
	gets(p);
	n=strlen(p);
	pp=(char*)calloc(n,sizeof(char));
	i=0;j=0;k=0;
	while(i<n)
	{
		if (*(p+i)==' ')
		{
			if (k==0)
			{
				*(pp+j)=*(p+i);
				j++;
				i++;
				k++;
			}
			else
			{
				i++;
			}
		}
		else
		{
			*(pp+j)=*(p+i);
			j++;
			i++;
			k=0;
		}
	}
	*(pp+j)='\0';
	printf("%s\n",pp);
}
/*
 * shuzu2.12.cpp
 *
 *  Created on: 2013-11-12
 *      Author: st
 */
int main()
{
	char a[100];
	cin.getline(a,100);
	int i,k,spcamount=0;

	for(i=0;i<strlen(a);i++)
	   if((a[i]==' ')&&(a[i+1]!=' '))
		   continue;
	   else
		   if((a[i]==' ')&&(a[i+1]==' '))
			   {spcamount++;
			   for(k=i;k<strlen(a)-spcamount;k++)
                a[k]=a[k+1];
			    i--;
			   }

   for(i=0;i<strlen(a)-spcamount;i++)
        cout<<a[i];
	return 0;



}
int main(){
	int i,j,b,c[100];
	char a[100];
	gets(a);
	b=strlen(a);
	for(i=0;i<=b;i++)
	c[i]=0;
	for(i=0;i<b;i++){
		if(a[i]==' ')
		c[i]=1;
	}
	for(i=0;i<b;i++){
		if(c[i]==0&&(c[i+1]==0||a[i+1]=='\n'))
	    printf("%c",a[i]);
	    else if(c[i]==0&&c[i+1]==1)
	    printf("%c ",a[i]);
}
	return 0;
}
char* getmemory(int num)
{
	char *p=(char*)malloc(num*sizeof(char));    //????????
	return p;
}

void main()
{
	char *str,*p1,*a,*b;          //str???????,p1?????????
	int n;                        //a,b???????????.
	str=getmemory(100);          // ?????
	p1=a=str;
	gets(str);
	n=strlen(str);
	b=a+n;
	for(str=a;str<b;)
	{
		if(*str==' ')
		{	p1=str;
			if(*(p1+1)==' ')
			{
				p1=str;
				for(;p1<b-1;p1++){*p1=*(p1+1);}
				n-=1;
			}
			else str++;
		}
		else str++;
	}
	for(p1=a;p1<a+n;p1++)printf("%c",*p1);
}
int main()
{
	char a,b;
	cin>>a;
	cout<<a;
	while((b=getchar())&&(b!='\n'))
	{
		if(b!=' ')
			cout<<b;
		if(b==' '&&a!=' ')
			cout<<b;

		a=b;
	}
	return 0;
}
int main () {
int i,l,j;
char s[max];
gets(s);
l=strlen(s);
for (i=0;i<l-1;i++) {
    if(s[i+1]==' '&&s[i]==' ') {
       for (;s[i+1]==' ';) {
        for(j=i;j<l-1;j++) {
               s[j]=s[j+1];
                           }
            s[l-1]='\0';
            l--;
                         
                            }
                                }
                    }
        puts(s);                                                 
            
             return 0;
            
             }
int main()
{
	char a[201];
	cin.getline(a,201);
	int len,f=0;
	len=strlen(a);
	for(int i=0;i<len;i++)
	{
		if(a[i]!=' ')
		{
			f=1;
			cout<<a[i];
		}else 
		{
			if(f==1)
			{
				cout<<' ';
				f=0;
			}
		}
	}
	return 0;
}
int main()
{
  char a[20000], temp;
  int i,j;
  j=0;
  for(i=0;i<20000;i++)//???????
  { scanf("%c", &temp);
    if(temp==a[j-1]&&a[j-1]==32);
    else {
          a[j]=temp;
          printf("%c", a[j]);
          j++;
	}
  }
  
  return 0;
}
int main(){
    int c,space=0;
    while(1){
        c = getchar();
        if(c == '\n'){break;}
        if(c == 32 && space == 0){
            putchar(c);
            space = 1;
        }
        else if(c != 32){
            putchar(c);
            space = 0;
        }
    }
    return 0;
}
int main()
{
	int i, flag = 0;
	char *p = NULL;
	char sentence[200];
	cin.getline(sentence,200);
	p = sentence;
	for (i = 0; sentence[i] != '\0'; i++)
	{
		if (sentence[i] != ' ')
		{
			*p = sentence[i];
			p++;
			flag = 1;
			continue;
		}
		if (sentence[i] == ' ' && flag == 1)
		{
			*p = sentence[i];
			p++;
			flag = 0;
		}
	}
	*p = '\0';
    cout << sentence;
	return 0;
}
int main()
{
 int l,i,k=0,nSpace=0;
 char a[1000],b[1000];
 gets(a);
 for(i=0;a[i]!='\0';i++)
 {
   if(nSpace<1){
     b[k]=a[i];
     k++;}
   if(a[i]==' ')
     nSpace ++;
   if(a[i+1]!=' ')
     nSpace=0; 
 }
 b[k]='\0';
 puts(b);
 return 0;
}
int main(){
	int i=0,num,j=1,m,n,k=1;
	char a[100];
	gets(a);
	num=strlen(a);
	for(i=0;i<100;i++){
		for(j=1;j<num;j++){
			if(a[j-1]!=' ' && a[j]==' ' && a[j+1]==' '){m=j;}
			if(a[j-1]==' ' && a[j]==' ' && a[j+1]!=' '){n=j;break;}
			if(a[j-1]!=' ' && a[j]==' ' && a[j+1]!=' '){n=num;}
		}for(k=1;k<=(num-n);k++){
			    a[m+k]=a[n+k];
				if(k==num-n)
				a[m+k]='\0';
		}
	}
	puts(a);
return 0;
}
//  ???????


int main()
{
    char str[50];
    cin.getline(str,50);
    for (int i=1;i<50;i++)
    {
        if (str[i]==' ')
        {
            while (str[i+1]==' ')
            {
                for (int j=i+1;j<50;j++)
                    str[j]=str[j+1];
            }
        }
    }
    cout<<str;
    return 0;
}
/*
 * zz2.cpp
 * function:???????
 * Created on: 2012-12-12
 * Author: sear
 */
int main() {
	char a[100][20]; //a[100][20]
	int j = 0, k = 0; //j,k??????j????????,
	char *i; //i????????
	while (cin >> a[j++]);//??????
	do { //??????
		cout << a[k++] << " ";
		i = &a[k - 1][0]; //??????????????
	} while (i != &a[j - 3][0]);//???????????????
	cout << a[j-2];//????????
	return 0;
}
int main(){
char ch[101];
	gets(ch);
	for (int i = 0;i<strlen(ch)-1;i++){
		if(ch[i]==' '&&ch[i+1]==' '){
			for (int j = i;j<strlen(ch);j++){
				ch[j]=ch[j+1];

			}
			i=i-1;
			}
		}
	cout<<ch<<endl;
	return 0;
}
int main()
{
char s[100],s0[100];
gets(s);
int i,k=0;
for(i=0;s[i]!='\0';i++){
 if(s[i]!=' '||(s[i]==' '&&s[i+1]!=' ')){
    s0[k]=s[i];
    k++;
 }
}
s0[k]='\0';
printf("%s",s0);
return 0;
}
//**********************************
//*???????.cpp              *
//*??????                    *
//*???2011-11-23                *
//**********************************


char str[101];                                   //??????
void function(char *q, int flag)                 //??flag???????????????????????????0??????1
{
	if (!*q)
	{
		return ;                                 //??????????????
	}
	if (*q != ' ')
	{
		cout << *q;                              //??????????????????1
		flag = 1;
	}
	else
		if (flag)
		{
			cout << " ";                         //??????????????????????????????0
			flag = 0;
		}
		return function(q + 1, flag);            //???????
}
int main()
{
	cin.getline(str,100);                        //?????
	function(str, 0);                            //???????????
	return 0;
}
void main()
{
  char *p,*q[100];
  int i,j,n;
  p=malloc(100*sizeof(char));
  gets(p);
  for(i=1,q[0]=p;i<100;i++)
  {
    q[i]=q[i-1]+1;
    if(*q[i]==' ')
    {
    for(j=1;*(q[i]+j)==' ';j++)1;
    q[i]=q[i]+j-1;
    }
    if(*(q[i]+1)=='\0'){n=i;break;}
  }
  for(i=0;i<=n;i++)printf("%c",*q[i]);
}
int main()
{
	char a[1000];
	int i,j;
	for(i=0;;i++)
	{
		scanf("%c",&a[i]);
		if(a[i]==32&&a[i-1]==32) {i--;}
		if(a[i]=='\n') {break;}
	}
	for(j=0;j<=i-1;j++)
	{printf("%c",a[j]);}
	return 0;
}
int main()
{
	char c[1000]={' '};
	int a,b,d,e,f,g,i,j,k,l,m,n,p;
	for(i=0;i<1000;i++)
	{   scanf("%c",&c[i]);
		if (c[i]!=' ') printf("%c",c[i]);
		else if (c[i-1]!=' ') printf("%c",c[i]);
		if (c[i]=='.') break;
	}
	return 7;
}
int main()
{
    char s[101];
    int b[101]={0};
    int length;
    int i;
    gets(s);

    length=strlen(s);
    for(i=0;i<length;i++)
    {
        if(s[i]==' ')
        {
            b[i]=1;
            if(s[i+1]!=' ')
            {
                b[i]=0;
            }
        }
    }
    for(i=0;i<length;i++)
    {
        if(b[i]==0)
        {
            printf("%c",s[i]);
        }
    }
     return 0;
}
void main()
{int i,n;
char *p;
p=(char*)malloc(100000*sizeof(char));
gets(p);
n=strlen(p);
for(i=0;i<n;i++,p++)
{if(*p!=' ')
{printf("%c",*p);}    /*???????????*/
if(*p==' ')            /*????????????????????????*/ 
{printf("%c",*p);
while(*p==' ')
{i++;p++;}
i=i-1;p=p-1;}
}
}
int main(){
 char str[200];
 int n,i,j,k;
 gets(str);
 for(i=0;str[i]!='\0';i++){
     if(str[i]==' '&&str[i+1]==' '){
		 k=i+1;
		 while(str[k]==' ') {
		    k++;
		 }
		 for(j=i+1;str[j]!='\0';j++){
		     str[j]=str[j+k-i-1];
		 }
	 }
 }
 printf("%s",str);
return 0;
}
int main()
{
	int a,b,i,j;
	char kj[1000];
	gets(kj);
	a=strlen(kj);
	b=a;
	for(i=0;i<a;i++){
		if(kj[i]==' '){		
			if(kj[i+1]==' '){				
				for(j=i+1;j<a;j++){
					kj[j-1]=kj[j];					
				}
			b--;
			i--;
			}	
		}
	if(i==b-1)
		break;
	}
	for(i=0;i<b;i++){
	printf("%c",kj[i]);
	}
	return 0;
}
int main()
{
	char str[1000];
	for(int i = 0; cin >> str; i++)
	{
		if(i == 0)
			cout << str;
		else
			cout << " " << str;
	}
	cout << endl;

	return 0;
}
int main()
{
	char c,last=0;
	cin.get(c);//??
	while (c!='\n')//??????
	{
		if (!((c==' ')&&(last==' ')))//???????????????????????
		{
		    cout <<c;//????????   
		}
		last=c;//??last
		cin.get(c);//???????
	}
	
	return 0;
}
int main()
{
	char c[101],i,j=1,k;
	for (j=1;;j++)
	{
		c[j]=getchar();
		if (c[j]=='\n')
			break;
	}
	for (i=1;i<=j;i++)
	{
		if (c[i]==' ')
		{
			for (k=i+1;;k++)
			{
				if (c[k]==' ')
					c[k]=1;
				else
					break;
			}
		}
	}
	for (k=1;k<=j;k++)
	{
		if (c[k]!=1)
			putchar(c[k]);
	}
	return 0;
}
int main(){
    int n,a;
    char zfc[201];
    gets(zfc);
    n=strlen(zfc);
    for(int i=0;i<n;i++){
        if(zfc[i]==' '){
            a=0;
            for(int k=i+1;k<n;k++){
                if(zfc[k]==' '){
                    a++;
                }
                else{
                    break;
                }
            }
            for(int k=i+a+1;k<n;k++){
                zfc[k-a]=zfc[k];
            }
            n-=a;
        }
    }
    for(int i=0;i<n;i++){
        printf("%c",zfc[i]);
    }
    return 0;
}
int main(){
    char i=0,aa[100];
    gets(aa);
    char *p,*q;
    p=aa;
    while(*p!='\0'){
    if(*p!=' ')
    cout<<*p;
    if(*p==' '){
       cout<<*p;
       q=p;
       q++;
       while(*q==' ')
               q++;
              q--;
              p=q;
               }   
            p++;
              }
              
              return 0;
              }
int main(){
	int i,j;
	char a[105];
	gets(a);
	int u;
	for(u=0;a[u]!='\0';u++){
	for(i=0;a[i]!=0;i++){
		if(a[i]==' '&&a[i+1]==' '){
			for(j=i+1;a[j]!='\0';j++){
					a[j]=a[j+1];
			}
		}
		if(a[i]=='.'&&a[i+1]==' '){
			for(j=i+1;a[j]!='\0';j++){
					a[j]=a[j+1];
			}
		}
		if(a[i]==' '&&a[i+1]=='.'){
			for(j=i;a[j]!='\0';j++){
					a[j]=a[j+1];
			}
		}
	}
	}
	puts(a);
	return 0;
}
int main(){
	char s[1000];
	int i,j,k,t,l,f=0; 
	gets(s);
	l=strlen(s);
	for(i=0;i<l-1;i++){
		if(s[i]==' '&&s[i+1]==' '&&f==0){
			j=i;
			f=1;
		}
		else if(s[i]==' '&&s[i+1]!=' '&&f==1){
			k=i; 
			for(t=j;t<l-k+j;t++){
				s[t]=s[i];
				i++;
			}
			s[t]='\0';
			f=0;
			i=j;
		}
	}
	printf("%s",s); 
	return 0;
}
void main()
{
	int i,n,m=0,k;
	char *a;
	a=(char *)malloc(10000*sizeof(char));
	gets(a);
	for(i=0;*(a+i)!='\0';i++)
	{
		if(*(a+i)==' '&&*(a+i+1)==' ')
			continue;
		else printf("%c",*(a+i));
	}
}
int main()
{
	int i,j=0;
	char a[105],b[105];
	gets(a);
	for(i=0;i<=strlen(a);i++)
	{
		if(a[i]!=' '||a[i]==' '&&a[i+1]!=' ')
		{
			b[j]=a[i];
			j++;
		}
		else continue;
	}
	for(i=0;i<strlen(b);i++)
		cout<<b[i];
	cout<<endl;
	return 0;
}
int main(){
   int i,j,l,k,o=0;
   char a[10000],b[10000]={' '};
   gets(a);
   l=strlen(a);
   b[o++]=a[0];
   for(i=1;i<l;i++){
        if(a[i]!=' '||a[i]==' '&&a[i-1]!=' ') b[o++]=a[i];
        }
    for(i=0;i<o;i++) printf("%c",b[i]);
    
    
    scanf("%d",&i);
    return 0;
    }
int main()
{
    int i;
    char s[201]={0};
    gets(s);
    for(i=0;i<strlen(s);i++)
    {
        if(s[i-1]==' '&&(i-1>0)&&s[i]==' ')   continue;
        else printf("%c",s[i]);
}
    return 0;
}
int main()
{
	char x[101];
	cin.getline(x,	101);
	int i,	n1,	j;
	n1	=	strlen(x);
	for(i	=	0;	i	<	n1;	i++)
	{
		if(x[i]	==	' ')
		{
			int count	=	0;
			for(j	=	i	+	1;	j	<	n1;	j++)
			{
				if(x[j]	==	' ')
				{
					count++;
				}
				else
				{
					break;
				}
			}
		    strcpy(x	+	i,	x	+	i	+	count);
			n1	=	n1	-	count;
		}
	}
	cout	<<	x	<<	endl;
	return 0;
}
/*??? 1200012866 11.2*/
int main()
{
	char f,a[100];
	int x=0;
	while((f=getchar())!=EOF){//??
		a[x]=f;
		x++;
	}
	x=x-1;//????
	for(int i=0;i<=x;i++){//????????
		if(a[i]==32)
			if(a[i+1]==' ')
				continue;
		cout<<a[i];
		}		

	return 0;
}
int main()
{
	int i,n;
	char a[100];
	cin.getline(a,100);
	n=strlen(a);
	char *p;
	p=a;
	for(i=1;i<=n;i++)
	{
		if((*p==' ')&&(*(p+1)==' '))
		{
			p=p+1;
			continue;
		}
		cout<<*p;
		p=p+1;
	}
	return 0;
}
int main()
{  char string[100];
	int i;
	char c;
	gets(string);
   for(i=0;c=string[i]!='\0';i++)
   if(c=string[i]!=' ')
   printf("%c",string[i]);
   else
   if(c=string[i-1]!=' ')
   printf("%c",string[i]);
   else continue;
   printf("%c",'\n');
	return 0;
}
char t[200];
int main(){
int s,i,j,n,l;
gets(t);
l=strlen(t);
for(i=0;i<200;i++)
for(j=0;j<l;j++){
if(t[j]==' '&&t[j+1]==' '){
for(s=j;s<l;s++)
t[s]=t[s+1];
}
}
puts(t);
return 0;
}
void main()
{
	char *s;
	int i,j=0,n;
	s=(char *)malloc(1000*sizeof (char));
	gets(s);
	n=strlen(s);
	for(i=0;i<n;i++)
	{
		if(s[i]!=' ')
		{
			s[j]=s[i];
			j++;
		}
		else
		{
			if(s[i+1]!=' ')
			{
				s[j]=s[i];
				j++;
			}
		}
	}
	for(i=0;i<j;i++)printf("%c",s[i]);
	printf("\n");
	free(s);
}
int main()
{ 
	int l,i;
	char s[300];
gets(s);
l=strlen(s);
for(i=0;s[i]!='\0';i++){
if(s[i]!=32) printf("%c",s[i]);
if(s[i]==32&&s[i+1]!=32) printf("%c",s[i]);

}


	return 0;
}
int main(){
	int i,j=0,num;
	int k=0;
	char str[1000];
	char re[1100];
	gets(str);
	while(str[j]!='\0'){
		j++;
	}
	num=j;
	for(i=0;i<num;i++){
		if(str[i]!=' '){
			re[k]=str[i];
			k++;
		}else{
			if(str[i+1]!=' '){
				re[k]=str[i];
				k++;
			}
		}
	}
	re[k]='\0';
	puts(re);
	return 0;
}
int main()
{
   int q,i=0,j=0,w;
   char s[1000],t[1000];
   cin.getline(s,999);
   while(s[i]!='\0')
   {
	if(s[i]!=' '||(s[i]==' '&&s[i-1]!=' '))
	{
		cout<<s[i];
	}
	i++;
		
	}
	
	cin>>q;
	return 0;
}
int main()
{
	char str[1000];
	int i,j,flag=1;
	cin.getline(str,1000);
	int len=strlen(str);
	for(i=0;i<len;i++)
	{
		if(flag==0&&str[i]!=' ')cout<<' ';
		if(str[i]==' ')flag=0;
		else {flag=1;cout<<str[i];}
	}
	return 0;
}
int main()
{
	char chsentence[100000];
	char chnew[100000];
	int i, j, nlen;
	memset(chsentence, 0, sizeof(chsentence));
	memset(chnew, 0, sizeof(chnew));
	cin.getline(chsentence, 100000);
	for (i = 0, j = 0; chsentence[i] != '\0'; i++)
	{
		if(chsentence[i] != ' ')
		{
			chnew[j] = chsentence[i];
			j++;
		}
		else if (chsentence[i] == ' ')
		{
			if (chsentence[i - 1] == ' ')
				continue;
			else
			{
				chnew[j] = chsentence[i];
				j++;
			}
		}

	}
	nlen = strlen(chnew);
	for (i = 0; i < nlen; i++)
		cout << chnew[i];
	return 0;
}
void main()
{
	char a[100];
    int i,j,n,k=0;
	gets(a);
	n=strlen(a);
	for(i=0;i<=(n-1);i++)
	{
		if(a[i]!=32)
			printf("%c",a[i]);
		if(a[i]==32&&a[i-1]!=32)
		        printf("%c",a[i]);
	}
}
int main()
{
	char str[1000];
	int len,sum=0;
	cin.getline(str,999,'\n');
	len=strlen(str)-1;
	int i=0;
	while(i<=len-1)
	{
		if(str[i]==' '&&str[i+1]==' ')
		{
			for(int j=i;j<=len-1;j++)
				str[j]=str[j+1];
			sum=sum+1;
			i=i-1;
		}
		i=i+1;
	}
	for(int i=0;i<=len-sum;i++)
		cout<<str[i];
	return 0;
}
int main()
{
	int i,l;
	char a[100],*p=NULL,*q=NULL;
	cin.getline(a,100);
    l=strlen(a);
	p=a;
	for(i=0;i<l-1;i++)
	{
		if(*(p+i)==' '&&*(p+i+1)==' ')
		{
			for(q=a+i+1;*q!=0;q++)
				*q=*(q+1);
			i--;
			l--;
		}
	}
	cout<<a<<endl;
	return 0;
}
int main(int argc, const char * argv[]){
    char line[250];
    cin.getline(line, 210, '\n');
    char * p_1=line;
    for (int i=0; i<strlen(line); i++) {
        if (* (p_1+i)==' ') {
            if (* (p_1+i+1)!=' ') {
                cout<<* (p_1+i);
            }
        }
        else cout<<* (p_1+i);
    }
    return 0;
    
}
/*
 * hehe.cpp
 *
 *  Created on: 2012-12-11
 *      Author:??
 *  ???????????????????????????????????
 */
int main(){
	char a[200],*p;
	int lena,judge=0;
	cin.getline(a,200);
	p=a;
	lena=strlen(a);
	for(int i=0;i<lena;i++)
	{  if(*p==' '&&judge==0)
		{judge=1;
		 cout<<*p;
		}                       //???????????judge??
	   if(*p==' '&&judge==1)
		  ;                     //??????????
	   if(*p!=' ')
		   {cout<<*p;
		    judge=0;           //????????
		   }
	   p++;
	}
	return 0;
}
int main()
{
	char a[201];
	char *p = NULL;
	gets(a);
	p = a;
	int n = strlen(a);
	//cout << n << endl;
	int num = 0;
	for(p = a; p < a+n; p++)
	{
		if( *p == ' ' )
			num ++;
	    if( *p != ' ' && *(p-1) == ' ' )
			num = 0;
		if( num  == 0 || num == 1 )
			cout << *p;
	}
	return 0;
}
int main()
{
	int a, b[101] = { 0 };
	char str[101];
	char *p=NULL;
	int *q=NULL;
	cin.getline(str,101);
	a=strlen(str);
	for(q=b,p=str;p<str+a;p++,q++)
	{
		if(*p==' '&&*(p+1)==' ')
		{
			*q=1;
		}
	}
	for(q=b,p=str;p<str+a;p++,q++)
	{
		if(*q!=1)cout<<*p;
	}

	return 0;
}
int main()
{
char *p0,*p1;
int i,j;
p0=(char *)malloc(100*sizeof(char));
p1=(char *)malloc(100*sizeof(char));
gets(p0);
for(i=0,j=0;*(p0+i)!='\0';i++)
{if(*(p0+i)!=' '&&*(p0+i+1)==' '){*(p1+j)=*(p0+i);j++;*(p1+j)=' ';j++;}
else if(*(p0+i)!=' '&&*(p0+i+1)!=' ') {*(p1+j)=*(p0+i);j++;}
    else ;}
*(p1+j)='\0';
printf("%s",p1);
return 0;}
int main()
{
	char c[1000];
	int i,j,l;
	gets(c);
	l=strlen(c);
	for(i=0;i<=(l-1);i++)
		if((c[i]==32)&&(c[i+1]==32))
		{   i--;
			for(j=i+1;j<=(l-1);j++)
				{
					c[j]=c[j+1];
				}	
		}
	puts(c);
   return 0;




}
void main()
{
int i;
char a[10000],*p;
gets(a);
p=a;
for(i=0;*(p+i)!='\0';i++)
{
if(*(p+i)==' ')
{
printf(" ");
for(i=i+1;*(p+i)==' ';i++);
i=i-1;
}
else{printf("%c",*(p+i));}
}
}
int main()
{
	int i;
	char *p, *q;
	char ju[100];
	cin.getline(ju, 99);
	p = ju;
	q = ju;
	while (*p != 0)
	{
		if (*p == ' ')
		{
			if (*(p - 1) == ' ' || *(p - 1) == 0)
				*p = 0;
		}
		p++;
	}
	for (i = 0; i < p-q; i++)
	{
		if (ju[i] != 0)
		{
			cout << ju[i];
		}
	}
	return 0;
}
void main()
{
	int i,j,k,l,m,n;
	char c[100],*q;
	q=c;
	gets(q);
	for (i=0;*(q+i)!='\0';i++)
	{
		if (*(q+i)==' '&&*(q+i+1)==' ')
		{
			for (j=i;*(q+j)!='\0';j++)
			{
				*(q+j)=*(q+j+1);
			}
			i--;
		}
	}
	puts(q);
}
int main()
{
	int len,i,k=-1;
	char s[100],h[100];
	gets(s);
	len=strlen(s);
	for(i=0;i<len;i++){
		if((s[i]==s[i+1]&&s[i]!=' ')||s[i]!=' '||(s[i]==' '&&s[i+1]!=' ')){
			k++;
			h[k]=s[i];
		}
	}
	h[k+1]='\0';
	puts(h);
	return 0;
}
int main( )
{
	char str[100000];
	cin.getline(str, 100000);

	int i;//flag?????????

	for (i = 1; str[i] != '\0'; )
	{
		if ( str[i] == ' ' && str[i+1] == ' ' )
		{
			for (int j=i+1; str[j]!='\0';j++)
				str[j]=str[j+1];
		}
		else 
			i++;
	}

	cout<<str;

	return 0;
}
int main(void)
{
    char s[2000];
    gets(s);
   char ss[2000];
   int i,j=0;
   for(i=0;i<strlen(s);i++)
     {
        if(!((s[i]==32)&&(s[i+1]==32)))
            ss[j++]=s[i];  
  
         }
   ss[j]='\0';
    printf("%s",ss);
    getchar();
    getchar();
    
}
int main()
{
	int i,l,j;
	char a[256];
	gets(a);
	l=strlen(a);
	for(j=0;j<100;j++)
	{
	for(i=0;i<l;i++)
	{
		if(a[i]==' '&&a[i+1]==' ')
		{
			while(i<l)
			{
				a[i+1]=a[i+2];
				i++;
			}
		}
	}
	}
	printf("%s",a);
	return 0;
}
void main()
{char a=' ',b=' ';
 int i;
for (i=1;i<100;i++)
 {a=b;
  scanf("%c", &b);
  if (b==' '&&a==' ')
	  continue;
  else printf("%c", b);
  if (b=='.')
	  break;
 }
}
int main()
{
	char *str,*p,*start;
	str=(char *)calloc(1000,sizeof(char));
	for (p=str;*(p-1)!='\n';p++)
		scanf("%c",p);
	int countspace=0;
	start=str;

	for (p=str;*p!='\n';p++)
		if (*p==' ')
		{
			if (*(p-1)!=' ') start=p;
			countspace++;
			if (*(p+1)!=' ')
			{
				if (countspace>1)
					for (p=start+1;*(p-1)!='\n';p++)
						*p=*(p+countspace-1);
				countspace=0;
				p=start+1;
			}
		}
	for(p=str;*(p-1)!='\n';p++)
		printf("%c",*p);
	return 0;
}
int main(){
	int n,j,i,l,k,a;
	char z[256];
    gets(z);l=strlen(z);
	for(i=0;i<l;i++){
		if (z[i]!=' '||z[i-1]!=' '){printf("%c",z[i]);}	}
return 0;
}
int main(){
	char s[101],modified[101];
	int i,j;
	gets(s);
	j=0;
	for(i=0;i<strlen(s)-1;i++){
		if(s[i]!=' '||(s[i]==' '&&s[i+1]!=' ')){
			modified[j]=s[i];
			j++;		
		}
	}
	if(s[strlen(s)-1]!=' '){
		modified[j]=s[strlen(s)-1];
		modified[j+1]=0;
	}else
		modified[j]=0;
	printf("%s\n",modified);
	return 0;
}
int main()
{
	char sentence[100], *p;
	cin.getline(sentence, 100);
	p = sentence;
	int len = strlen(sentence), i = 0;
	while(i < len)
	{
		if(*p != ' ')    
		{
			cout << *p++;
			i++;
		}
		else
		{
			cout << ' ';
			p++;
			i++;
			while(*p == ' ')
			{
				p++;
				i++;
			}
		}
	}

return 0;
}
int main(){
    int i,j;
    char a[LEN+1],b[LEN+1]={0};
	gets(a);
	int l=strlen(a);
	for(i=1,j=1;i<l;i++){
		b[0]=a[0];
		if(a[i]==' '&&a[i-1]!=' '){
			b[j]=a[i];
			j++;
		}else if(a[i]!=' '){
			b[j]=a[i];
			j++;
		}
	}
	puts(b);
	return 0;
}
/*************************************************************************************************************
* @file .cpp
* @author ????
* @date 
* @description
*         ??????
*/


int main()
{
	char a[100];
	char *p = NULL,*q = NULL;
	cin.getline(a, 100);
	for(p = a,q = a; *q != '\0';q++)//????????????????????????????????
	{
		if(*q == ' '&& *(q + 1) == ' ')//?????????
			continue;
		else//??????????????
			*p++ = *q;
	}
	q = p - 1;//?????????
	for(p = a; p <= q; p++)
		 cout << *p;//??
	return 0;
}
main()
{
	char a[3000],i;
	gets(a);
	for(i=0;i<(signed)strlen(a);i++)
	{
		printf("%c",a[i]);
		if(a[i]==' ')
		{
		for(;i<(signed)strlen(a);i++)
		{
			if(a[i+1]!=' ')
				break;
		}}
	}
			
}
void main()
{
	char *p=(char *)calloc(256,sizeof(char));
	char *q=(char *)calloc(256,sizeof(char));
	gets(p);
	int i,j;
	for(i=0,j=0;*(p+i)!='\0';i++)
	if(*(p+i)==' '&&*(p+i+1)==' ');
	else *(q+j)=*(p+i),j++;
	puts(q);
}
//***************************************************************************
//?????????????????                                        *
//????wayne                                                             *
//?????12.22                                                           *
//***************************************************************************
int main()
{
	char sentence[100];                           //?????????
	int i,len;                                    //??????
	cin.getline(sentence,100);                    //??????
	len=strlen(sentence);                         //??????
	for (i=0;i<=len-2;i++)                        //????
	{
		if (sentence[i]==' '&&sentence[i+1]==' ') //?????
			continue;                             //???
		else 
			cout<<sentence[i];                    //????
	}
	cout<<sentence[len-1]<<endl;                  //???????????
	return 0;
}
int main()
{
	char sentence[1000][20];
	int i = 0, i0;
	while(cin >> sentence[i])
	{
			i++;
	}
	i0 = i - 1;
	for (i = 0; i < i0; i++)
	{
		cout << sentence[i] << " ";
	}
	cout << sentence[i];

return 0;
}
int main()
{
	int i,k,j;
	char a[1000];    //????
	cin.getline(a,1000);
	k=strlen(a);       //?i????
	for(i=0;i<k;i++)
		if(a[i]==' ')
		{
			if(a[i+1]==' ')
				{for(j=i+1;j<k-1;j++)            
				a[j]=a[j+1];a[j]=0;k--;i--;}            /*???????k??1?i?1????i*/
		}
	cout<<a;
    return 0;
}
int main()
{
    char a[100];
    int i=0,j=0,num=0,beg=0;
    while((a[i]=getchar())!='\n')i++;//????????? 
    num=i-1;
    i=0;
    while(i<=num)
    {
      while(a[i]==' '&&i<=num)i++;//?????? 
      beg=i;
      while(a[i]!=' '&&i<=num)i++;//?????? 
      for(j=beg;j<i;j++)
      cout<<a[j];//??????j????????j????i 
      if(j!=num+1)cout<<' ';
    } 
    return 0;
}
int main(){
    char w[300];
	int a,b,n,i,j;
	gets(w);
	printf("%c",w[0]);
	for(i=1;w[i]!='\0';i++){
		if((w[i-1]==' ')&&(w[i]==' ')){
			
		}else{
			printf("%c",w[i]);
		}
	}
    return 0;
}
/*
 * ????1203.cpp
 * ??????
 * ?????2012-12-12
 * ???????????????
 */



int main() {
	char str[100], *p = NULL; //????
	cin.getline(str, 100); //????
	p = str; //?????
	for (p = str; *p != '\0'; ++p) {
		if (*p != ' ') {
			while (*p != ' ' && *p != '\0')
				cout << *p++; //??????????
			if (*p == '\0')
				break; //??????????
			else
				cout << ' '; //????????????
			p--; //???????
		}
	}
	return 0; //????
}
int main() {
    int i,m,k;
    char kg[200];
    gets(kg);
    m=strlen(kg);
    for(i=0;i<m-1;i++){
        if(kg[i]==' '){
            if(kg[i+1]!=' '){continue;}
            else{k=i;
                while(i<m-1){kg[i]=kg[i+1];
                             i++;
                }
                i=k-2;
                m--;
            }
        }
    }
    kg[m]='\0';
    printf("%s",kg);
    return 0;
}
int main()
{
char s[1000];
int i,l,k,m;
gets(s);
l=strlen(s);
m=l;
for(i=0;i<l-1;i++){
	if(s[i]==' '&&s[i+1]==' '){
		for(k=i;k<m-1;k++){s[k]=s[k+1];}
		i--;
	    m--;
	}
}
for(i=0;i<m;i++){printf("%c",s[i]);}
return 0;
}
int main(){
    char zfc[10005];
	gets(zfc);
	int i,l;
	l=strlen(zfc);
	for(i=0;i<l;i++){
		if(zfc[i]!=' '||(zfc[i]==' '&&zfc[i-1]!=' ')){
			printf("%c",zfc[i]);
		}
	}
	return 0;
}