#include <iostream>#include <string> int main() { using namespace std; for (string line; getline(cin, line); ) { int i = stoi(line); cout << i << endl; }}
1 -1 2 3 rest - 4
1 -1 2 3
terminate called after throwing an instance of 'std::invalid_argument' what(): stoi
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!