#include <iostream>
#include <sstream>
#include <string>
int main()
{
std::string s;
std::cout << "Input a number: ";
std::getline(std::cin, s);
std::stringstream ss(s); // construct string stream from existing string data
int n;
ss >> n;
std::cout << "Number was: " << n << '\n';
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3N0cmVhbT4KI2luY2x1ZGUgPHN0cmluZz4KCmludCBtYWluKCkKewogICAgc3RkOjpzdHJpbmcgczsKCiAgICBzdGQ6OmNvdXQgPDwgIklucHV0IGEgbnVtYmVyOiAiOwogICAgc3RkOjpnZXRsaW5lKHN0ZDo6Y2luLCBzKTsKCiAgICBzdGQ6OnN0cmluZ3N0cmVhbSBzcyhzKTsgLy8gY29uc3RydWN0IHN0cmluZyBzdHJlYW0gZnJvbSBleGlzdGluZyBzdHJpbmcgZGF0YQogICAgaW50IG47CgogICAgc3MgPj4gbjsKICAgIHN0ZDo6Y291dCA8PCAiTnVtYmVyIHdhczogIiA8PCBuIDw8ICdcbic7Cn0K