#include<stdio.h>
/*in 2 out,countinue space 2 single space*/
main()
{
	int c, np;
	// c=getchar();
	np = 0;
	while ((c = getchar()) != EOF)
	{

		while (c == ' ')/*filter ' '*/
		{
			++np;/*make flag*/
			c = getchar();
		}
		if (np > 0)
			putchar(' ');/*converge 2 single*/
		np = 0;/*reboot flag*/
		putchar(c);
		// putchar(' ');
		// putchar(n);
	}
}