Files
python/TangDou/AcWing/TwoWaySearch/190_Prepare.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

16 lines
335 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#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;
}