This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
int main() {
string x = "ABCDEFG";
cout << x.substr(0, 2) << endl; //从索引0开始,截取2个长度
cout << x.substr(2) << endl; //从索引2开始,截取到结尾
/*
输出:
AB
CDEFG
*/
return 0;
}