/std:c++17
#include<iostream>
#include<sstream>
#include<string>
#include<optional>
#include<tuple>
using namespace std;
auto try_parse(const string& s) -> tuple<string, optional<int>>
{
string sval;
optional<int> ival;
auto is = istringstream(s);
is >> sval;
if(isdigit(s.back()))
{
int i = 0;
is >> i;
ival = i;
}
return {sval, ival};
}
int main()
{
string line;
getline(cin, line);
auto [sval, ival] = try_parse(line);
cout << "string value:\t" << sval << "\n";
if(ival != nullopt)
{
cout << "int value:\t" << ival.value() << "\n";
}
cin.get();
}