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