题解 | #字符串分隔#

字符串分隔

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

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

int main() {
    string str1;
    while (getline(cin,str1)) 
    { // 注意 while 处理多个 case
        while(str1.size()>8)
        {
            cout<<str1.substr(0,8)<<endl;//截取0-7
            str1 = str1.substr(8,str1.size()-8);
        }    
        int len = str1.size();
        for (int i = len+1;i<=8;i++)
        {
            str1+='0';
        }
        cout<<str1<<endl;
    }
    return 0;
}
// 64 位输出请用 printf("%lld")

全部评论

相关推荐

牛客83700679...:简历抄别人的,然后再投,有反馈就是简历不行,没反馈就是学历不行,多投多改只要技术不差机会总会有的
点赞 评论 收藏
分享
晗江雪:其实我只是觉得你们导员说的很好笑
点赞 评论 收藏
分享
ohs的小木屋:比不少实习待遇高了
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务