#include <iostream>
#include <ios>
#include <sstream>
int main()
{
std::cout << std::boolalpha;
const char* inputs[] = { "14", "abc", "14a", "-14", nullptr };
for (int i = 0; inputs[i]; i++)
{
std::istringstream in(inputs[i]);
int j;
std::cout << inputs[i]
<< " valid integer ? "
<< (in >> j && in.eof())
<< "\n";
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8aW9zPgojaW5jbHVkZSA8c3N0cmVhbT4KCmludCBtYWluKCkKewogICAgc3RkOjpjb3V0IDw8IHN0ZDo6Ym9vbGFscGhhOwogICAgY29uc3QgY2hhciogaW5wdXRzW10gPSB7ICIxNCIsICJhYmMiLCAiMTRhIiwgIi0xNCIsIG51bGxwdHIgfTsKICAgIGZvciAoaW50IGkgPSAwOyBpbnB1dHNbaV07IGkrKykKICAgIHsKICAgICAgICBzdGQ6OmlzdHJpbmdzdHJlYW0gaW4oaW5wdXRzW2ldKTsKICAgICAgICBpbnQgajsKCiAgICAgICAgc3RkOjpjb3V0IDw8IGlucHV0c1tpXQogICAgICAgICAgICAgICAgICA8PCAiIHZhbGlkIGludGVnZXIgPyAiCiAgICAgICAgICAgICAgICAgIDw8IChpbiA+PiBqICYmIGluLmVvZigpKQogICAgICAgICAgICAgICAgICA8PCAiXG4iOwogICAgfQogICAgcmV0dXJuIDA7Cn0K