找到第三个子字符串后显示打印错误消息

Hello I am pretty new to c++ I have a question regarding splitting of a string. For example I have a string std::string str = "jump 110 5"; and between jump 110 and 5 can be as many spaces as there can be. I want to save 110 in an int variable and if after the number 110 another number or character should appear then the loop should break. So far I have removed all the spaces and saved 110 in a variable and printed it out and the number five get's ignored. How can I break or print an error message after 110 saying that the string is not valid?

#include <iostream>
#include <fstream>
#include <string>
#include <vector>


int main() {

std::string str = "jump 110 5";
size_t i = 0;
for ( ; i < str.length(); i++ ){ if ( isdigit(str[i]) ) break; }


str = str.substr(i, str.length() - i );


int id = atoi(str.c_str());
std::cout<<id;



 return 0;

}