题解 | #字符串分隔#
字符串分隔
https://www.nowcoder.com/practice/d9162298cb5a437aad722fccccaae8a7
import java.util.Collections;
import java.util.Objects;
import java.util.Scanner;
/**
* @author hll[yellowdradra@foxmail.com]
* @since 2023-03-10 16:07
**/
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
String str = in.nextLine();
int len = str.length();
for (int i = 0;;) {
if ((i + 1) << 3 > str.length()) {
System.out.println(str.substring(i << 3) + String.join("",
Collections.nCopies(8 - len & 7, "0")));
break;
}
System.out.println(str.substring(i << 3, ++i << 3));
}
}
}
