string substr (size_t pos = 0, size_t len = npos) const;
#include <iostream>
#include <string>
using namespace std;
int main()
{
string s1 = "i love lyy, lyy like eat mouse";
string s2 = s1.substr(7, 3);
cout << s2 << endl;
s2 = s1.substr(5);
cout << s2 << endl;
try
{
s2 = s1.substr(50);
}catch(out_of_range)
{
cout << "out_of_range" << endl;
}
cout << s2 << endl;
s2 = s1.substr(s1.length());
cout << s2 << endl;
return 0;
}