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

string fSplit(const string& fString)
{
    size_t pos = fString.find(' '); // find first space
    if(pos == string::npos)         // if no spaces were found
         return fString;            // return the whole string
    else                            // otherwise
         return fString.substr(0, pos);  // return the sub-string
}

int main()
{
    cout << fSplit("One two three four") << '\n';
}
