#include <iostream>
#include <string>
int main()
{
constexpr char seperators[] = " ,.\t" ;
const std::string full_name = "Nicolai M. Josuttis" ;
std::cout << "full name: " << full_name << '\n' ;
auto pos = full_name.find_first_of(seperators) ;
if( pos != std::string::npos )
{
const std::string first_name = full_name.substr(0,pos) ;
std::cout << "first name: " << first_name << '\n' ;
}
pos = full_name.find_last_of(seperators) ;
if( pos != std::string::npos )
{
const std::string last_name = full_name.substr(pos+1) ;
std::cout << "last name: " << last_name << '\n' ;
}
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RyaW5nPgoKaW50IG1haW4oKQp7CiAgICBjb25zdGV4cHIgY2hhciBzZXBlcmF0b3JzW10gPSAiICwuXHQiIDsKCiAgICBjb25zdCBzdGQ6OnN0cmluZyBmdWxsX25hbWUgPSAiTmljb2xhaSBNLiBKb3N1dHRpcyIgOwogICAgc3RkOjpjb3V0IDw8ICJmdWxsIG5hbWU6ICIgPDwgZnVsbF9uYW1lIDw8ICdcbicgOwoKICAgIGF1dG8gcG9zID0gZnVsbF9uYW1lLmZpbmRfZmlyc3Rfb2Yoc2VwZXJhdG9ycykgOwogICAgaWYoIHBvcyAhPSBzdGQ6OnN0cmluZzo6bnBvcyApCiAgICB7CiAgICAgICAgY29uc3Qgc3RkOjpzdHJpbmcgZmlyc3RfbmFtZSA9IGZ1bGxfbmFtZS5zdWJzdHIoMCxwb3MpIDsKICAgICAgICBzdGQ6OmNvdXQgPDwgImZpcnN0IG5hbWU6ICIgPDwgZmlyc3RfbmFtZSA8PCAnXG4nIDsKICAgIH0KCiAgICBwb3MgPSBmdWxsX25hbWUuZmluZF9sYXN0X29mKHNlcGVyYXRvcnMpIDsKICAgIGlmKCBwb3MgIT0gc3RkOjpzdHJpbmc6Om5wb3MgKQogICAgewogICAgICAgIGNvbnN0IHN0ZDo6c3RyaW5nIGxhc3RfbmFtZSA9IGZ1bGxfbmFtZS5zdWJzdHIocG9zKzEpIDsKICAgICAgICBzdGQ6OmNvdXQgPDwgImxhc3QgbmFtZTogIiA8PCBsYXN0X25hbWUgPDwgJ1xuJyA7CiAgICB9Cn0K