and about saving a part of a string you can use the std::string::substr function
1 2 3
string bim= "1234567897899"
// the first parameter is where you want the function to start copying and the second is the last position.
string temp = bim.substr(10, 12);
the problem in your code is that you are trying to access a position out of range, you can't access the 13th position because there are only 12 position, the reason is that you string has 13 number but in c++ you start counting at 0, not 1.