题解 | #字符串分隔#
字符串分隔
https://www.nowcoder.com/practice/d9162298cb5a437aad722fccccaae8a7
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String line;
while((line=br.readLine())!=null && line.length()>0){
int count = line.length()%8==0?line.length()/8:line.length()/8+1;
line = line+"0000000";
for(int i=0;i<count*8;i=i+8){
System.out.println(line.substring(i,i+8));
}
}
}
}
#华为面试#
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String line;
while((line=br.readLine())!=null && line.length()>0){
int count = line.length()%8==0?line.length()/8:line.length()/8+1;
line = line+"0000000";
for(int i=0;i<count*8;i=i+8){
System.out.println(line.substring(i,i+8));
}
}
}
}
#华为面试#