题解 | #字符串分隔#

字符串分隔

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

#include<bits/stdc++.h>

using namespace std;

int main(){

string str;
while(cin>>str){
    for(int i=0;i<str.length();i+=8){
        string tmp = str.substr(i,8);
        if(tmp.length()!=8){
            for(int j=tmp.length();j<8;++j)
                tmp.insert(j,1,'0');
        }
        cout<<tmp<<endl;
    }
}
return 0;

}

全部评论

相关推荐

点赞 收藏 评论
分享
牛客网
牛客企业服务