字符串分隔c++
字符串分隔
http://www.nowcoder.com/questionTerminal/d9162298cb5a437aad722fccccaae8a7
#include<iostream>
#include<string>
using namespace std;
int main()
{
string s;
while(cin>>s)
{
int temp=s.length();
int i=0;
while(temp>0)
{
if(temp>=8)
{
for(int j=0;j<8;j++)
{
cout<<s[i];
i++;
temp--;
}
cout<<endl;
}
else
{
int j=8;
while(temp>0)
{
cout<<s[i];
i++;
j--;
temp--;
}
while(j>0)
{
cout<<0;
j--;
}
cout<<endl;
}
}
}
}