刷题04:HJ4

代码如下:

#include <iostream>
#include <string>
using namespace std;

int main()
{
    
    
    string s1;
    while (cin >> s1) {
    
    
        char s2[8];
        int count = 0;
        int i;
        for (i = 0; i < s1.length(); i++) {
    
    
            cout << s1[i];
            count++;
            if (count > 7) {
    
    
                count = 0;
                cout << endl;
            }
        }
        if (count > 0) {
    
    
            for (int j = i; j < s1.length(); j++)
                cout << s1[j];
            for (int j = count; j < 8; j++)
                cout << '0';
            cout << endl;
        }
    }
    return 0;
}

AC通过:
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_27538633/article/details/115312635