HJ4 字符串分隔 | 杂乱无章的初级程序员的题解

字符串分隔

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

#include <iostream>
#include <string>

using namespace std;

int main(int, char **)
{
    string s;
    getline(cin, s);

    const size_t subStrLen = 8;
    s.append(string((subStrLen - s.length() % subStrLen) % subStrLen, '0'));

    for (size_t pos = 0; pos < s.length(); pos += subStrLen) {
        cout << s.substr(pos, subStrLen) << endl;
    }
}
全部评论

相关推荐

lingo12:1.最好加个业务项目,大部分面试官工作以后会更偏重业务 2.实习部分描述一般般,可能hr看到会觉得你产出不够不给你过简历 3.蓝桥杯这些大部分人都有的,不如不写,反而减分项。
点赞 评论 收藏
分享
评论
2
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务