字符串分割 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;
}
全部评论

相关推荐

投递阿里巴巴控股集团等公司7个岗位 >
点赞 评论 收藏
转发
点赞 收藏 评论
分享
牛客网
牛客企业服务