字符串分割 c++

字符串分隔

http://www.nowcoder.com/questionTerminal/d9162298cb5a437aad722fccccaae8a7

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

int main(){
    string s;
    while(getline(cin,s)){
        while(s.length()%8)
            s.append("0");
        for(int i=0;i<s.length();i+=8)
            cout<<s.substr(i,8)<<endl;
    }
    return 0;
}
全部评论

相关推荐

用微笑面对困难:只要你保证项目和获奖都是真的就行尤其是“对战,总负责人”啊这些套职,基本上队员,打杂的都这么写
点赞 评论 收藏
分享
不愿透露姓名的神秘牛友
昨天 14:25
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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