#include <iostream>
#include <regex>
#include <string>
#include <experimental/optional>
std::experimental::optional<int> find_int_regex( const std::string & s )
{
static const std::regex r( "(\\d+)" );
std::smatch match;
if( std::regex_search( s.begin(), s.end(), match, r ) )
{
return std::stoi( match[1] );
}
return {};
}
int main()
{
for( std::string line; std::getline( std::cin, line ); )
{
auto n = find_int_regex( line );
if( n )
{
std::cout << "Got " << n.value() << " in " << line << std::endl;
}
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8cmVnZXg+CiNpbmNsdWRlIDxzdHJpbmc+CiNpbmNsdWRlIDxleHBlcmltZW50YWwvb3B0aW9uYWw+CgpzdGQ6OmV4cGVyaW1lbnRhbDo6b3B0aW9uYWw8aW50PiBmaW5kX2ludF9yZWdleCggY29uc3Qgc3RkOjpzdHJpbmcgJiBzICkKewoJc3RhdGljIGNvbnN0IHN0ZDo6cmVnZXggciggIihcXGQrKSIgKTsKCXN0ZDo6c21hdGNoIG1hdGNoOwoJaWYoIHN0ZDo6cmVnZXhfc2VhcmNoKCBzLmJlZ2luKCksIHMuZW5kKCksIG1hdGNoLCByICkgKQoJewoJCXJldHVybiBzdGQ6OnN0b2koIG1hdGNoWzFdICk7Cgl9CiAgICByZXR1cm4ge307Cn0KCmludCBtYWluKCkKewoJZm9yKCBzdGQ6OnN0cmluZyBsaW5lOyBzdGQ6OmdldGxpbmUoIHN0ZDo6Y2luLCBsaW5lICk7ICkKCXsKCQlhdXRvIG4gPSBmaW5kX2ludF9yZWdleCggbGluZSApOwoJCWlmKCBuICkKCQl7CgkJCXN0ZDo6Y291dCA8PCAiR290ICIgPDwgbi52YWx1ZSgpIDw8ICIgaW4gIiA8PCBsaW5lIDw8IHN0ZDo6ZW5kbDsKCQl9Cgl9CglyZXR1cm4gMDsKfQo=