#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';
}
I2luY2x1ZGUgPHN0cmluZz4KI2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKc3RyaW5nIGZTcGxpdChjb25zdCBzdHJpbmcmIGZTdHJpbmcpCnsKICAgIHNpemVfdCBwb3MgPSBmU3RyaW5nLmZpbmQoJyAnKTsgLy8gZmluZCBmaXJzdCBzcGFjZQogICAgaWYocG9zID09IHN0cmluZzo6bnBvcykgICAgICAgICAvLyBpZiBubyBzcGFjZXMgd2VyZSBmb3VuZAogICAgICAgICByZXR1cm4gZlN0cmluZzsgICAgICAgICAgICAvLyByZXR1cm4gdGhlIHdob2xlIHN0cmluZwogICAgZWxzZSAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBvdGhlcndpc2UKICAgICAgICAgcmV0dXJuIGZTdHJpbmcuc3Vic3RyKDAsIHBvcyk7ICAvLyByZXR1cm4gdGhlIHN1Yi1zdHJpbmcKfQoKaW50IG1haW4oKQp7CiAgICBjb3V0IDw8IGZTcGxpdCgiT25lIHR3byB0aHJlZSBmb3VyIikgPDwgJ1xuJzsKfQo=