题解 | #字符串分隔#

字符串分隔

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

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

int main() {
    string s;
    cin >> s;
    int cnt=0;
    for(auto s1 : s){
        cout<<s1;
        cnt++;
        if(cnt == 8){
            cnt=0;
            cout<<endl;
        }
    }
    if(cnt !=8 && cnt != 0){
        while(cnt != 8){
         cout<<0;
         cnt++;
        }
    }

}

全部评论

相关推荐

迷茫的大四🐶:价格这么低都能满了?
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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