题解 | #字符串分隔#
字符串分隔
https://www.nowcoder.com/practice/d9162298cb5a437aad722fccccaae8a7
#include <iostream>
#include <string>
using namespace std;
int main() {
string str1;
while (getline(cin,str1))
{ // 注意 while 处理多个 case
while(str1.size()>8)
{
cout<<str1.substr(0,8)<<endl;//截取0-7
str1 = str1.substr(8,str1.size()-8);
}
int len = str1.size();
for (int i = len+1;i<=8;i++)
{
str1+='0';
}
cout<<str1<<endl;
}
return 0;
}
// 64 位输出请用 printf("%lld")
