题解 | #字符串分隔#
字符串分隔
http://www.nowcoder.com/practice/d9162298cb5a437aad722fccccaae8a7
#include #include using namespace std; int main() { string str; getline(cin,str); int len = str.length() %8; if(str.length() == 0) { cout<<""; } else if(len !=0) { for(int i=0;i<8-len;i++) { str =str+'0'; } } int count=str.length()/8; int n=1; while(count>=n) { for(int j=0+8*(n-1);j<8*n;j++) { cout << str[j] ; } cout<<endl; n++; } }