#include <iostream>
#include <fstream>
#include <cstring>
using namespace std;
ifstream f("trim.in");
ofstream g("trim.out");
char s[100];
int n;
void Trim(char s[100])
{
int p, u, i, n, k=-1;
char w[100];
n=strlen(s);
p=0; while (s[p]==' ') ++p;
u=n-1; while (s[u]==' ') --u;
w[0]='\0';
for (i=p; i<=u; ++i)
{
++k; w[k]=s[i];
}
++k; w[k]='\0';
s[0]=0;
strcpy(s,w);
}
int main()
{
f.getline(s,100);
Trim(s);
g << s;
}