题解 | #字符串分隔#

字符串分隔

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

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        StringBuilder sb = new StringBuilder(sc.next());
        int len = sb.length();
        int a = 0;
        int b = 8;
        while (len>8) {
            System.out.println(sb.substring(a, b));
            a=a+8;
            b = b + 8;
            len = len - 8;
        }
        sb.append("00000000");
        System.out.print(sb.substring(a,b));
    }}

全部评论

相关推荐

07-10 13:59
门头沟学院 Java
点赞 评论 收藏
分享
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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