题解 | #截取字符串#
截取字符串
https://www.nowcoder.com/practice/a30bbc1a0aca4c27b86dd88868de4a4a
#include <iostream> #include <string> using namespace std; string cutString(string str, size_t length){ return str.substr(0,length); } int main() { string str; size_t length; cin >> str; cin >> length; cout << cutString(str,length) << endl; } // 64 位输出请用 printf("%lld")