题解 | #字符串分隔#
字符串分隔
https://www.nowcoder.com/practice/d9162298cb5a437aad722fccccaae8a7
#include <iostream> #include<string> using namespace std; int main() { string s; getline(cin,s); int len=s.length(); string s1; for(int i=0;i<len;){ s1=""; if(len-i>=8){ for(int j=0;j<8;j++)s1+=s[i++]; cout<<s1<<endl; }else{ int len1=len-i; for(int j=0;j<len1;j++)s1+=s[i++]; for(int j=0;j<8-len1;j++)s1+="0"; cout<<s1<<endl; } } return 0; } // 64 位输出请用 printf("%lld")