题解 | #字符串分隔#
字符串分隔
https://www.nowcoder.com/practice/d9162298cb5a437aad722fccccaae8a7
#include <cmath> #include <iostream> using namespace std; int main() { string str; while(cin>>str) { str = str+"0000000"; while(str.size()>= 8) { cout<<str.substr(0,8)<<endl;//返回并打印0-8的子串 str = str.substr(8);//将第8个字符开始的子串赋值给str } } return 0; } // 64 位输出请用 printf("%lld")