题解 | #字符串分隔#
字符串分隔
https://www.nowcoder.com/practice/d9162298cb5a437aad722fccccaae8a7
#include <iostream> using namespace std; int main() { string s; string tmp; while (cin >>s) { // 注意 while 处理多个 case while(s.size()>8) { tmp=s.substr(0,8); s=&s[8]; cout<<tmp<<"\n"; } cout.fill('0'); cout.width(8); cout.setf(ios::left,ios::adjustfield); cout << s << endl; } } // 64 位输出请用 printf("%lld")