题解 | #字符串分隔#
字符串分隔
http://www.nowcoder.com/practice/d9162298cb5a437aad722fccccaae8a7
#include<iostream>
using namespace std;
int main()
{
string s;
while(cin>>s)
{
int l=s.size();
int outlen=l;
if(l%8!=0)
{
outlen=(l/8+1)*8;
}
int cur=1;
int i=0;
while(cur<=outlen)
{
if(i<l)
{
cout<<s[i];
}
else
{
cout<<'0';
}
if(cur%8==0)
{
cout<<endl;
}
cur++;
i++;
}
}
}