semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main()
{   int f(int x);

    int a[10];
    int i,n;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {scanf("%d",&a[i]);
     printf("%d\n",f(a[i]));
    }
return 0;
}
     int f(int x)

{  
     int f1=1,f2=1,f3,b,i;
     if(x==1||x==2) return(1);
     else 
     {for(i=2;i<x;i++)
     {f3=f1+f2;f1=f2;f2=f3;}
     b=f3;
     return(b);}}
int main()
{
    int a[21]={0,1,1};
    int N=0,n=0,i=0;
    cin>>N;
    for(i=3;i<=20;i++)
       a[i]=a[i-1]+a[i-2];
    for(i=1;i<=N;i++)
    {
       cin>>n;
       cout<<a[n]<<endl;
    }
    return 0;
}
//********************************
//*??  ??????        *****
//*????? 1300012753     ***** 
//*???2013.11.20          *****   
//********************************
int cal(int i)
{
	if(i == 1 || i == 2)
	return 1;
	else
	return cal(i - 1) + cal(i - 2);
}
int main()
{
	int n;
	cin >> n;
	int a[100];
	for(int i = 1; i <= n; i++)
	{
		int t;
		cin >> t;
		a[i] = cal(t); 
	}
	for(int i = 1; i <= n; i++)
	cout << a[i] << endl;
	return 0;
}
int main()
{
   int k,s,g;
   int a[20];
   a[1]=1;
   a[2]=1;
   for(int j=3;j<=20;j=j+1)
   {
    a[j]=a[j-1]+a[j-2];
    }
   cin>>k;
   for(int i=0;i<k;i++)
   {
     cin>> g;
     s=a[g];
     cout<<s<<endl;   
    }
}
int main () {
	int a[999],b[999],c[999],i,k,n,d[999];
		scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&d[i]);
		a[i]=1;
		b[i]=1;
	}
	for(i=0;i<n;i++){
		if(d[i]>=3){
			for(k=3;k<=d[i];k++){
			c[i]=a[i]+b[i];
			a[i]=b[i];
			b[i]=c[i];}
		printf("%d\n",c[i]);}
		else{printf("1");}
	}
		


	 return 0;
}
int f(int n);


int main(){
  int a[10000],s[10000],x,k;
  scanf("%d",&k);
  for(x=0;x<k;x++){
     scanf("%d",&a[x]);
  
     s[x]=f(a[x]);
  
     printf("%d\n",s[x]);
  }
  
return 0;
}

int f(int n){
  int a[100000],i;
  
	  a[1]=1;
  
      a[2]=1;
 
  if(n>2){
	  for(i=3;i<=n;i++){
		  a[i]=a[i-1]+a[i-2];

	  }
  }
  
  return a[n];
}
int a[100];
int F(int n)
    { if(n==1||n==2)return 1;
     else return F(n-1)+F(n-2);
     }
int main()
{ int n;
 cin>>n;
 for(int i=0;i<n;i++)
    {
    cin>>a[i];
    }
 for(int j=0;j<n;j++)
    {cout<<F(a[j])<<endl;
    }
 return 0;
}
//============================================================================
// Name        : shulie.cpp
// Author      : shaodian
// Version     :
// Copyright   : Your copyright notice
// Description :
//============================================================================


int main() {
	int s[100]={0};//???????100???
	int n=0;
	cin>>n;
	for(int i=0;i<n;i++)//?i??1?i??
	{	cin>>s[i];
	if (s[i]==1||s[i]==2)cout<<1<<endl;//???????????????1

	else
	{long long int f[10000];//????????
    f[1]=1;f[2]=1;
    for(int j=3;j<=s[i];j++)//?j??3?????s[i]???
    {
    	f[j]=f[j-1]+f[j-2];//???????????
    }

	cout<<f[s[i]]<<endl;}
	}

	return 0;
}
int main()
{
    int a[100]={1,1,1,1};
    int i=0;
    int *p=a+3;
    for(i=0;i<100;i++)
    {
       *(p+i)=*(p+i-1)+*(p+i-2);
       //cout<<*(p+i)<<endl;
    }
    int n;
    cin>>n;
    i=0;
    while(i<n)
    {
        int m;
        cin>>m;
        cout<<a[m]<<endl;
        i++;

    }
  }
/*
 * ????22.cpp
 * ??????
 * ????: 2012-9-30
 * ??:??????????
 */


int main(){
	int n=0,i=0,j=0,m=0;              //i,j?????
	cin>>n;
	for (i=0;i<n;i++){            //???????
		cin>>m;
		int a[m];
		a[0]=1;
		a[1]=1;
		for (j=2;j<=m;j++){
			a[j]=a[j-1]+a[j-2];   //????????m?
		}
        cout<<a[m-1]<<endl;
	}
	return 0;
}
int main()
{
	int f[20] = {1, 1}, k, a, i, n;
	cin >> n;
	for (i = 1; i <= n; i++)
	{
		cin >> a;
		for (k = 2; k < a; k++)
		{
			f[k] = f[k - 2] + f[k - 1];
		}
		cout << f[k-1] << endl;
	}
	return 0;
}
int ans[21];

int work(int a)
{
	if (a <= 2)
		return 1;
	return (work(a - 1) + work(a - 2));
}

int main()
{
	int n, a;
	int i;
	cin >> n;
	for (i = 1; i <= n; i++)
	{
		cin >> a;
		cout << work(a) << endl;
	}
	return 0;
}
int F(int a);
int main()
{
	int n,a,i,sz[20],result;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&a);
		
		result=F(a);
		printf("%d\n",result);
	}
	return 0;
}
int F(int a){
	int result,i,st[20];
	st[0]=0;
	st[1]=1;
	for(i=2;i<=a;i++){
		st[i]=st[i-1]+st[i-2];
	}
	result=st[a];
	return result;
}
int main()
{
	int a[20]={1,1};
	int i;
	int N;
	int b[20];
	for (i=2;i<20;i++)
	{
		a[i]=a[i-1]+a[i-2];	
	}
	
	
	
	scanf("%d",&N);
	printf("\n");
	for (i=0;i<=N-1;i++)
	{
		scanf("%d",&b[i]);
		printf("\n");
	}
	
	for (i=0;i<=N-1;i++)
	{
		printf("%d",a[b[i]-1]);
		printf("\n");
	}
	
	return 0;
}
int f(int x)
{
	if (x > 2)
		return (f(x - 1) + f(x - 2));
	if (x == 1)
		return 1;
	if (x == 2)
		return 1;
}

int main()
{
	int n, x;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> x;
		cout << f(x) << endl;
		cout << endl;
	}
	return 0;
}
/*
 * Filename:parctice_fibonacciarray.cpp
 * Author: Wu Yiming
 *  Created on: 2011-11-2
 *  Function: find certain number in Fibonacii array
 */



int main()
{
	int n,pos,i;
	cin>>n;
	int fib[21]={1,1};
	while (n)
	{
		cin>>pos;
		for(i=2;i<pos;i++)
			fib[i]=fib[i-1]+fib[i-2];
		cout<<fib[i-1]<<endl;
		n--;
	}
	return 0;
}
int f(int a)
{
if(a==1||a==2)
return 1;
else
return (f(a-1)+f(a-2));
}
int main()
{
int a[100];
int n,i,j;
cin>>n;
if(n<=100)
{
for(i=0;i<n;i++)
cin>>a[i];
for(i=0;i<n;i++)
if(a[i]>=1&&a[i]<=20)
cout<<f(a[i])<<endl;
}
return 0;
}
int main(){
    int n,i,k,j;
    scanf("%d",&n);
    int a[n],c[n];
    for(i=0;i<n;i++){
    scanf("%d",&a[i]);
}
    int b[21];
    b[0]=0;
    b[1]=b[2]=1;
    for(i=3;i<21;i++){
       b[i]=b[i-1]+b[i-2];
       }
    for(i=0;i<n;i++){
       k=a[i];
       c[i]=b[k];
       }
    for(i=0;i<n;i++){
    printf("%d\n",c[i]);
}
    scanf("%d",&k);
    return 0;
}
int F(int n);
int main()
{
	int n,m[999],j=0;
	scanf("%d",&n);
	for(j=0;j<n;j++)
	{
		scanf("%d",&m[j]);
	}
	j=0;
	for(j=0;j<n;j++)
	{
		printf("%d\n",F(m[j]));
	}
	return 0;
}



  int F(int n)
  {
	  int k[999];
	  int i=1;
	  k[1]=1;
	  k[2]=1;
	  
	  if(n==1)
		  return 1;
	  if(n==2)
		  return 1;
	  else
		  for(i=3;i<=n;i++)
		  {
			  k[i]=k[i-1]+k[i-2];
		  }
		  return k[n];
  }
//
//  main.cpp
//  poj
//
//  Created by ChuPan,Wong on 9/27/13.
//  Copyright (c) 2013 ChuPan,Wong. All rights reserved.
//


int main(int argc, const char * argv[])
{
    int num[20];
    num[0]=num[1]=1;
    for(int i=2;i<20;i++){
        num[i] = num[i-1]+num[i-2];
    }
    int n;
    cin>>n;
    int x;
    while(n--){
        cin>>x;
        cout<<num[x-1]<<endl;
    }
    return 0;
}
int f(int n);
int main(){
	int a0,a1,i,n,l,sz[100];
	scanf("%d",&l);
	for(i=0;i<l;i++){
		scanf("%d",&n);
//		printf("%d",f(n));
		sz[i]=f(n);
	}
	for(i=0;i<l;i++){
		printf("%d\n",sz[i]);
	}
	return 0;
}
int f(int n){
	int a0,a1,a2,i,r;
	a0=1;
	a1=1;
	r=0;
	if(n==1){
		return 1;
	}
	else if(n==2){
		return 1;
	}
	else if(n>2){
	for(i=0;i<n-2;i++){
		a2=a0+a1;
		r=a2;
		a0=a1;
		a1=a2;
	}
	}
	return r;
}
//1,1,2,3,5,8
int fun(int x);
int main()
{
    int i,n,a[20];
    scanf("%d",&n);
    for(i=0;i<n;i++)
    scanf("%d",&a[i]);
    for(i=0;i<n;i++)
    printf("%d\n",fun(a[i]));
    return 0;
}
int fun(int x)
{
    int b[100],i;
    if(x==1||x==2)return 1;
    else
    { 
        b[0]=b[1]=1;
        for(i=2;i<x;i++)
        b[i]=b[i-1]+b[i-2];
        return b[i-1];
        }
        }
int add(int a1,int b1);
int main()
{
	int q,p,n,result,i,a,k,sz[1000];
	scanf("%d",&n);
	for(k=0;k<n;k++)
	{
		scanf("%d",&a);
		p=1;
		q=1;
	    for(i=2;i<a;i++)
		{
		  result=add(p,q);
		  p=q;
		  q=result;
		}
		if(a==2||a==1)
		{
		  sz[k]=1;
		}
		else
		{
			sz[k]=result;
		}
	}
	for(k=0;k<n;k++)
	{
	  printf("%d\n",sz[k]);
	}
    return 0;
}

int add(int a1,int b1){
	int s;
	s=a1+b1;
	return s;
}
int f(int x)
{
    int a[1000]={1,1};
    for(int i=2;i<x;i++)
    a[i]=a[i-1]+a[i-2];
    return a[x-1];
}
int main()
{
  int n;
  scanf("%d",&n);
  int b[1000];
  for(int i=0;i<n;i++)
  scanf("%d",&b[i]);
    for(int i=0;i<n;i++)
  printf("%d\n",f(b[i]));
  getchar();
  getchar();
}
int fac(int);

int main()
{
	int n, y, times;
	cin >> times;
	for (int i = 0; i < times; i++)
	{
	    cin >> n;
	    y = fac(n);
	    cout << y << endl;
	}
	
	return 0;
}

int fac(int n)
{
	if (n == 1 || n == 2)
		return 1;
	else
		return fac(n - 1) + fac(n - 2);
}
//***********************************
//*    ??????                 *
//*    ??????                 *
//*    ?????2011?10?2?      *
//***********************************
int main()
{
	int a , x1 , x2 , x3 , i , j , n;
	cin >> n;
	for(i = 1;i <= n; i = i + 1)
	{
		cin >> a;//a?????,1<=a<=20
		x1 = 1;
		x2 = 1;//x1,x2?????????
		if(a == 1 || a == 2)
			cout << "1" << endl;//???????1?????
		else
		{
			for(j = 1;j <= a - 2;j = j + 1)//?a?????a-1???
			{
				x3 = x1 + x2;
				x1 = x2;
				x2 = x3;//????????????
			}
				cout << x3 << endl;
		}
	}
	return 0;
}
int main(int argc, char *argv[])
{
    int n;
    scanf("%d",&n);
    int shulie[20];
    int i;
    shulie[0]=1;
    shulie[1]=1;
    for(i=2;i<=19;i++){
        shulie[i]=shulie[i-1]+shulie[i-2];
    }
    int ceshi[n];
    for(i=0;i<n;i++){
        scanf("%d",&ceshi[i]);
    }
    for(i=0;i<n;i++){
        printf("%d\n",shulie[ceshi[i]-1]);
    }
  return 0;
}
int main()
{
    int f(int);
    
    int n, i, a;
    
    cin >> n;
    
    for(i = 0; i < n; i++)
    {
        cin >> a;
        
        a = f(a);
        
        cout << a << endl;
    }
    
    return 0;
}

int f(int a)
{
    if(a == 1 || a == 2) return 1;
    else
    {
        return f(a - 1) + f(a - 2);
    }
}
int f(int n)
{
 if(n==1)
  return 1;
 else if(n==2)
  return 1;
 else
  return f(n-1)+f(n-2);      
}
int main()
{
 int n,i,a[10000];
 scanf("%d",&n);
 for(i=0;i<n;i++)
  scanf("%d",&a[i]);
 for(i=0;i<n;i++)
 {
  printf("%d\n",f(a[i]));                
 }
 getchar();
 getchar();
 return 0;    
}
int f(int n)
{
    int c;
    if(n==1||n==2)
    c=1;
    else
    c=f(n-1)+f(n-2);
    return(c);
}
main()
{
      int n,i,m;
      int f(int n);
      scanf("%d",&n);
      for(i=0;i<n;i++)
      {
             scanf("%d",&m);
             printf("%d\n",f(m));
      }
      getchar();
      getchar();
}
int main()
{
	int a[10000],b[10000],n,i=3,j=1;
	memset(a,0,sizeof(a));
	memset(b,0,sizeof(b));
	b[1]=1;
	b[2]=1;
	cin>>n;
	for(j=1;j<=n;j++)
	{
		cin>>a[j];
	}
	for(i=3;i<=10000;i++)
	{
		b[i]=b[i-1]+b[i-2];
	}
	for(j=1;j<=n;j++)
	{
		cout<<b[a[j]]<<endl;
	}
	return 0;
}
//1200012979
int look(int);
int main()
{
	int n, a, count=0;
	cin >> n;
	while(count < n)
	{
		count++;
		cin >> a;
        cout << look(a)<< endl;
	}
	return 0;
}

int look(int a)
{
	if(a < 3)
		return 1;
	else
	return look(a-1)+look(a-2);
}
int main(){

int a=1 ,b=1,n,e,sz[10000]={1,1},j,i;
scanf("%d",&n);
for(j=0;j<n;j++){
scanf("%d",&e);

for(i=2;i<e;i++){
sz[i]=sz[i-1]+sz[i-2];
}
printf("%d\n",sz[e-1]);










}
return 0;
}
int main()
{
	int f[100],s[100],n,i;
	cin >>n;
	int a,b;
	a=1;
	b=1;
    f[0]=a;
    f[1]=b;
	for( i=0;i<n;i++)
	{
		cin >>s[i];
	}
	for(int j=2;j<100;j++)
	{
		f[j]=f[j-1]+f[j-2];
	}
	for( i=0;i<n;i++)
	{
		a=s[i];
		cout <<f[a-1]
		<<endl;
	}
	return 0;
}
int fab(int num);                     //??fab??
int main()                            //?????
{
	int n,i;                          //??????n,i,n???????i?????
	int num;                          
	cin>>n;
	for(i=1;i<=n;i++)                 //??n?????????????
	{
	   cin>>num;
	   cout<<fab(num)<<endl;
	}
	
return 0;
}
int fab(int num)                     //??fab??
{
	if(num==1)                       //??????1
	{return 1;}
	if(num==2)                       //??????1
	{return 1;}
	if(num!=1&&num!=2)               //????
	{return fab(num-1)+fab(num-2);}


}
int fei(int a)
{
	if (a == 1 || a == 2)
	{
		return 1;
	}
	else
	{
		return fei(a - 1) + fei(a - 2);
	}
}
int main()
{
	int n, i, m;
	cin >> n;
	for (i = 1; i <= n; i++)
	{
		cin >> m;
		cout << fei(m) << endl;
	}
	return 0;
}
int main()
{
	char str[1000],c1,c2;
	int i,j,num=0;
	gets(str);
	for(i=0;(str[i])!='\0';i++)
	{
		c1=str[i];
		if(c1==' ') 
		{
			for(j=i+1;(c2=str[j])==' ';j++)
			{
				num+=1;
			}
			for(j=i+1;str[j]!='\0';j++)
			{
				str[j]=str[j+num];
			}
			num=0;
		}
	}
	printf("%s",str);
}
int main(){
char zf[200];
gets(zf);
int i=0;
int k;
int s,b;
int len=strlen(zf);
while(zf[i]){
	if(zf[i]==' '&&zf[i+1]==' '){
     b=i;
	 k=i;
	while(zf[k]==' '){
     k=k+1;
	}
	s=k-i;
	while(b<=len-s){
		zf[b+1]=zf[b+s];
		b++;
		
	}
	len=len-s+1;
	}
	i=i+1;

}

printf("%s",zf);

return 0;
}
int main()
{
	char input[100], *p = NULL, *q = NULL;
	int length;
	cin.getline(input, 100);
	length = strlen(input);
	for (p = input + 1; p < input + length; p++)
	{
		if (*p == ' ' && *(p - 1) == ' ')		//??????????????????????????
		{
			for (q = p; *q != '\0'; q++)
			{
				*q = *(q + 1);
			}
			p--;
		}
	}
	cout << input << endl;
	return 0;
}
int main(){
    char a[300];
    gets(a);
    int i,j;
    int LEN;
    for(i=0,j=0;j<strlen(a);i++,j++){
        while(a[j]==' ' && a[j+1]==' ')
        j++;
        a[i]=a[j];
        LEN=i;
    }
    a[LEN+1]='\0';
    printf("%s",a);
    return 0;
}
void main()
{
	char a;
	int i=0;
	for(;a!='\n';)
	{
	a=getchar();	
	if(a!=' ')
	{printf("%c",a);i=0;}
	else if((a==' ')&&(i==0))
	{i++;printf("%c",a);continue;}
	else continue;
	}
}
int main(){
	char suoyou[200];
	gets(suoyou);
	int i,n;
	int a,l=0;
	n=strlen(suoyou);
	for(i=1;i<n;i++){
		if(suoyou[i-1]==' '){
			if(suoyou[i]==' '){
				for(a=i-1;a<n;a++){
					suoyou[a]=suoyou[a+1];
					suoyou[n-l]='\0';
					
				}
				l++;
				i--;
			}
		}
	}
	puts(suoyou);
	return 0;
}
int main()
{
	int u, v, l, num = 0;
	char str[100], *p = NULL, *r = NULL;
	cin.getline(str, 100);
	p = str;
	r = str;
	l = strlen(str);
	for (u = 0; u <= l - 1; u++)
	{
		if(*(p + u) != ' ')
		{
			*(p  + u - num) = *(p + u);
		}
		else
		{
			*(p + u - num) = ' ';
			for (v = u + 1; *(p + v) == ' '; v++)
			{
				num++;
			}
			u = v - 1;
		}
	}
	u = 0;
	for (u = 0; u <= l - 1 - num; u++)
	{
		cout << *(p + u);
	}
	cout << endl;
	return 0;
}
int main(){
    int i,j,n,s,e;
    char a[300];
    gets(a);
    n=strlen(a);
    for (s=0;s<n;s++){
        if (a[s]==' '&&a[s+1]==' '){ 
            for (e=s+1;e<n;e++){
                if (a[e]!=' '){
                    break;
                }
            }
            for (i=s+1;i<e;i++){
                a[i]=0;
            }
            s=e;  
        }
    }
    for (i=0;i<n;i++){
        if (a[i]!=0){
            printf("%c",a[i]);
        }
    }
}
int main(){
	int i,j,c,l;
	char a[201];
	gets(a);
	l=strlen(a);
	for(i=0;i<l;i++){
		if(a[i]==' '&&a[i+1]==' '){
			for(j=i+2;j<l;j++){
				if(a[j]!=' '){
					break;
				}
			}
			for(c=0;c<l;c++){
				a[i+1+c]=a[j+c];
			}
		}
	}
	puts(a);
	return 0;
}
int main()
{   int i,j=0,n;
    char str[1000001],s[1000001];
    cin.getline(str,1000001);
    n=strlen(str);
    for(i=0;i<n;i++)
    {
    	if(str[i]!=' ')
    	{
    		s[j]=str[i];
    		j++;
    	}
    	else if(str[i]==' '&&str[i+1]!=' '){
    		s[j]=str[i];
    		j++;
    	}
    	else continue;
    }
          cout<<s;
    return 0;
}
int main(){
  int n,l,i,m;
  char z[1000],c;
  gets(z);
  l=strlen(z);
  m=l;
  for(int t=0;t<l;t++){for(i=0;i<l;i++)
  {if(z[i]==' ')
  {if(z[i+1]==' '){for(i;i<l;i++){z[i]=z[i+1];}
  z[m-1]=0;m--;i--;}
  }
  }}
  printf("%s",z);
return 0;
}
int main()
{
    char *p;
    int i;
    void guolv(char *p);
    p=(char *)malloc(1000);
    gets(p);
    guolv(p);
        return 0;
}

void guolv(char *p)
{
     int i;
     for(i=0;(*(p+i))!='\0';i++)
     {
                                if(((*(p+i))==' ')&&((*(p+(i+1)))==' '));
                                else
                                printf("%c",*(p+i));
     }
}
main()
{
 char str[1000]={""};
 gets(str);
 int len=strlen(str);
 int i;
 for(i=0;str[i]!='\0';i++)
 {
  int j=i;
  if(str[i]==' ')
  {
  i++;
  while(i<len)
  {
   if(str[i]==str[i-1])
   i++;
   else
   {i--;break;}
  }
  }
  printf("%c",str[j]);

 }
}
/* ???????????.cpp
 * ??? 1200012826 ??
 * ???2012?12?9?
 */
int main()
{
	char a[200];
	int i;
	char *p=a, *q=NULL;
	cin.getline(a, 200, '\n');
	while(*p != '\0')
	{
		if(*p == ' ')															// ?????????? 
		{ 
			if(*(p+1) != ' ')
			{
				p++;
			}																	// ????????????????p?1????? 
			else
			{
				q=p;
				for(p=p+1; *p != '\0'; p++)
				{
					*p= *(p+1);
				}
				p=q;
			}																	// ?????????q????p?????p+1?????????
																				// ??????????p???? 
		}
		else 
		{
			p++;
		} 																		// ??????????????													
	}
	p=a;																		// ?p?????a???? 
	for( ; *p != '\0'; p++)
	{
		cout << *p ;
	}																			// ????????? 
	return 0; 
}
int main()
{
	char *p,c;
	int i;
	p=(char *)malloc(sizeof(char));
	for(i=0;;i++)
	{
		scanf("%c",&c);
		if(c=='\n')
		{
			*(p+i)='\0';
			break;
		}
		else
		{
			*(p+i)=c;
		}
	}
	for(i=0;;i++)
	{
		c=*(p+i);
		if(c=='\0')
		{
			break;
		}
		else if(c!=' ')
		{
			printf("%c",c);
		}
		else if(c==' '&&*(p+i-1)!=' ')
		{
			printf("%c",c);
		}
	}
	return 0;
}
int main()
{
    char words[128][128],gt;                     //???????words[][]???????gt 
    int m;                                       //??????????????????? 
    for(int i=0;i<128;i++)
    {
        cin>>words[i];
        gt=getchar();
        if(gt=='\n')
        {
            m=i;
            break;
        }                                        //???????????????? 
    }                                            //??getchar()?????????????????????????????????????? 
    for(int i=0;i<m;i++)cout<<words[i]<<' ';     //???????????????????????????????? 
    cout<<words[m];
    return 0;
}
int main()
{
    char *p;
    char str[200];
    p = str;
    int i,n,j,b=0;
    cin.getline(str,200);
    n = strlen(str);
    for(i=0;i<n-1;i++)
    {
        if(*(p+i)==' ')
        {
          for(j=i+1;j<n;j++)
          {
              if(*(p+j)==' ')
                b++;
              else
                break;
          }
          i = i + b;
          b = 0;
        }
        cout << *(p+i);
    }
    cout << *(p+n-1) <<endl;
}
int main()
{
	char s[100], *p;
	int d[100] = {0}, *q, l;
	cin.getline(s,100);
	l = strlen(s);
	for (p = s, q = d;*p != '\0';p++,q++)
	{
		if (*p == ' ')
		{
			if (*(p - 1) == ' ')
				*q = 1;
		}
	}
	p = s;
	q = d;
	for (int j = 0; j < l;j++)
	{
		if (*q == 0)
			cout << *p ;
		p++;
		q++;
	}
	return 0;
}
int main()
{
    char ch[1000];
    cin.getline(ch,999);
    int len,i;
    len=strlen(ch);
    for(i=0;i<len-1;i++)
    {
        if((ch[i]>='a'&&ch[i]<='z')||(ch[i]>='A'&&ch[i]<='Z'))cout<<ch[i];
        else if((ch[i-1]>='a'&&ch[i-1]<='z')||(ch[i-1]>='A'&&ch[i-1]<='Z'))cout<<ch[i];

    }
    cout<<ch[len-1];
    return 0;
}
main()
{
  char s[10000];
  int i,j,k;
  gets(s);
  for(i=0;s[i]!='\0';i++)
  {
    if(s[i]==' '&&s[i-1]==' ')
    {
      for(j=i;;j++)
      {
        s[j]=s[j+1];
        if(s[j]=='\0')
        break;
      }
      if(s[i]==' ')
      i--;
    }
  }
  printf("%s",s);
}
char a[1000];

int main()
{
    gets(a);
    char *p = a;
    cout << *p;
    for(int i = 1; i < strlen(a); i++){
        if(*(p+i-1)==' '&&*(p+i)==' ')
            continue;
        cout << *(p+i);
    }
}
int main()
{
	int i = 0, flag = 0;                           //i????????????flag?????????
	char word[100];                               
	cin.getline(word, 200);                 //?????
    char *p = word;
	for(i = 0; *(p + i) != '\0'; i++)                 
	{
		if(flag == 0 && *(p + i) == ' ')            //flag = 0?????????????flag = 1????????????
            flag = 1;
		
		else if (flag == 1 && *(p + i) == ' ')      //????????????????????????'['????
			*(p + i) = '[';
		else if (flag == 1 && *(p + i) != ' ')      //????????????????????flag = 0
			flag = 0;
    }
	for (i = 0; *(p + i) != '\0'; i++)            //????????'['
		if(*(p + i) != '[')
		cout << *(p + i);
	return 0;
}
int main()
{
  char a[65535],b[65535];
  gets(a);
  int l=strlen(a);
  b[0]=a[0];
  for(int i=1,k=1;a[i]!='\0';i++)
  {
    if(a[i-1]==' '&&a[i]==' ')
    {}
    else
    {b[k]=a[i];
    k++;
    }
  }
  puts(b);
  
  getchar();
  getchar();
}
void move(char*t,int d){
	//for(;*(t-1)!=0;t++) *(t-d)=*t; ????
	for(;*t!=0;t++)
		*(t-d)=*t;
	*(t-d)=*t;
}
void deal(char*c){
	if(*c==0)return;
	else if(*c!=' ')deal(c+1) ;
	else{
		char*t=c+1;
		for(;*t==' ';t++);
		int d=t-c-1;
		if(d)move(t,d);
		//deal(t);????t????????
		deal(c+1);
	}
}
int main()
{
	char c[201];
	cin.getline(c,201);
	deal(c);
	cout<<c;
	return 0;
}
int main ()
{
	int i=0;

	char a[201],b[201];

	cin.getline (a,200);

	char *p;

	for (p=a;*p!='\0';p++)
	{
		if (*p!=' ')
		{
			b[i]=*p;
			i++;
		}
		if (*p==' ')
		{
			b[i]=' ';
			i++;
			for (;*p!='\0';p++)
			{
				if (*p!=' ')
				{
					b[i]=*p;
					i++;
					break;
				}
			}
		}
	}
	b[i]='\0';
	cout <<b<<endl;

	return 0;
}
int main()
{
	char str1[200],str2[200] = "",*p,*q,i;
	p=str1;q=str2;
	cin.getline(str1,200);
	for(;*p!='\0';p++)
	{
		if(*p==' '&&*(p-1)==' ')//????????
			continue;
		else
		{
			*q=*p;
			q++;//?????????????????????????????
		}
	}
	for(i=0;str2[i]!='\0';i++)
	cout<<str2[i];//????
	cout<<endl;

	return 0;
}
int main()
{
	int i;
	char c[300]={0};
	gets(c);
	for(i=0;i<299;i++)
	{
		if(c[i]==' '&c[i+1]==' ') c[i+1]=0;
	}
	for(i=0;i<299;i++)
	{
		if(c[i]==0&c[i+1]==' ') c[i+1]=0;
	}
	for(i=0;i<300;i++)
	{
		if(c[i]!=0) printf("%c",c[i]);
	}
	return 0;
}
//*****************************
//*??? :???????     *
//*??   :???             *
//*??   :2011?11?         *
//*****************************
int main()
{
	int m;
	char *p, *w, q[100];
	cin.getline(q,100);
	m = strlen(q);
 	w = &q[100];
	p = &q[100];
	for (p = q; p < q + m; p++)
	{
		if (*p == ' ')
		{
			for (w = p + 1; *w == ' '; w++)
			{
				*w = '1';
			}
		}
	}
	for (w = q; w < q + m; w++)
	{
		if (*w != '1') cout << *w;
	}
	return 0;
}
int main(){
    char juzi[201];
    gets(juzi);
    char danci[201][201];
    int sum;
    sum=strlen(juzi);
    int ks[201];
    int zz[201];
    int k,z,i;
    k=0;
    z=0;
    for(i=0;i<sum;i++){
        if(i==0||(juzi[i-1]==' '&&juzi[i]!=' ')){
            ks[k]=i;
            k++;
             }
            if(i==sum-1||(juzi[i]!=' '&&juzi[i+1]==' ')){
              zz[z]=i;
              z++;
                }
            }
         int n,g;
         for(g=0,i=0;g<k;g++,i++){
         for(n=0;n<=zz[i]-ks[i];n++){
             danci[g][n]=juzi[n+ks[i]];
         }
        }
        for(i=0;i<k;i++){
            if(i==0){
                printf("%s",danci[i]);
            }else{
                printf(" %s",danci[i]);
            }
        }
    
    return 0;
}
int main(){
    int n,i,j,c=0;
    char s1[500];
    char s2[500];
    gets(s1);
    n=strlen(s1);
    int a[500]={0};
    for(i=n-1;i>=0;i--){
         if(s1[i]==' '){
                if(s1[i-1]==' '){
                        a[i-1]=a[i]+1;
                        c++;
                        }
                }
         }
    for(i=0,j=0;i<n;i++,j++){
         if(a[i]!=0){
                i=i+a[i];
                }
         s2[j]=s1[i];       
         }
    s2[n-c]='\0';
    printf("%s",s2);
    return 0;
}
int main()
{
	char a[201],b[201];      //????????????
	gets(a);                 //?????
	int flag=0;              //??????????????????
	char *pa=a,*pb=b;        //????????????????
	while(*pa!='\0')         //??????????????
	{
		if(*pa==' ')         //????????????????????????????????????
		{
			if(flag==0)
			{
				*pb=*pa;
				pb++;
				flag=1;
			}
		}
		else                 //???????????????
		{
			flag=0;
			*pb=*pa;
			pb++;
		}
		pa++;
	}
	*pb=*pa;                 //?????
	cout<<b<<endl;           //????
	return 0;
}
void del(char a[100],int k,int n)
{
	int i;
	for (i=k;i<=n;i++) a[i]=a[i+1];
}

int main()
{
	char a[100]; int i,n;
	gets(a); n=strlen(a);
	i=1;
	while (i<=n)
		if ((a[i-1]==' ')&&(a[i]==' ')) 
		{
			del(a,i,n);
			n--;
		} else i++;
	puts(a);
	return 0;
}
int main(int argc, char* argv[])
{ int q=0,i,j;
char tra[1000],yaode[1000];
gets(tra);
for(i=0,j=0;i<1000;i++)	
if(tra[i]!=' '){
		yaode[j]=tra[i];
	    j++;
		q=0;
	}
	else
		if(tra[i]==' '&&q==0){
			yaode[j]=tra[i];
			q++;
			j++;
		}
		else 
			if(tra[i]=='.'){
				yaode[j]=tra[i];
				break;
			}
			printf("%s",yaode);

	return 0;
}
int main()
{
	char a[500],b=' ';
    int i;
	gets(a);
	for(i=0;a[i]!=0;i++)
	{
		while((a[i]==b)&&(a[i+1]==b))
		{
			i++;
		}
		printf("%c",a[i]);
    }
}