#include <iostream>
#include <string>
using namespace std;

int main()
{
    size_t i, j, len;
    string str;

    cout << "Enter string: ";
    getline(cin, str);

    len = str.length();

    i = 0;
    while (i < len)
    {
        if (str[i] == ' ')
        {
            for (j = i + 1; j < len; ++j)
            {
                str[j - 1] = str[j];
            }
            --len;
        }
        else
            ++i;
    }

    str.resize(len);

    cout << str << endl;

    //system("pause");
    return 0;
}