int string2int(std::string& str) { std::istringstream in_stream(str); int res; in_stream >> res; return res; } std::string int2string(int num) { std::ostringstream out_stream; out_stream << num; return out_stream.str(); }