题解 | #字符串分隔#

字符串分隔

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

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

int main() {
    string s;
    getline(cin, s);
    int res = (8 - s.size() % 8) % 8;
    s += string(res, '0');
    for (int i = 0; i < s.size(); i += 8) {
        cout << s.substr(i, 8) << endl;
    }
}

全部评论

相关推荐

点赞 评论 收藏
分享
08-28 18:00
门头沟学院 Java
华为投了笔试做了已经挂了
投递华为技术有限公司等公司10个岗位
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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