每八个字符换一次行,然后调参,看样例输出正确就大差不差了

补齐的话一个while解决

#include <iostream>
using namespace std;

int main() {
    string s;cin >> s;
    int i;
    for(i = 0;i < s.length();i ++){
        cout << s[i];
        if( i % 8 == 7 ) cout << endl;
    }while( i % 8 != 0 ){
        cout << 0;i ++;
    }
    return 0;
}

#牛客春招刷题训练营# + 链接