题解 | #字符串分隔#

字符串分隔

https://www.nowcoder.com/practice/d9162298cb5a437aad722fccccaae8a7

#include <bits/stdc++.h>
using namespace std;

int main() {
    string str;
    while(cin>>str)
    {
        int len=str.size();
        if(len!=0)
        {
            int i=8-len%8;
            while(i--)
            {
                str=str+'0';
            }
            
        }
        for(int i=0;i<len;i+=8)
        {
            cout<<str.substr(i,8)<<endl;
        }
    }
}
// 64 位输出请用 printf("%lld")

全部评论

相关推荐

1 收藏 评论
分享
牛客网
牛客企业服务