题解 | #字符串分隔#
字符串分隔
http://www.nowcoder.com/practice/d9162298cb5a437aad722fccccaae8a7
初始化补位列,减少循环补位时间。
#include <iostream>
int main() {
std::cout << "Hello World!";
return 0;
}
class HelloWorld {
import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
String str = sc.next();
if(null != str&&!str.trim().equals("")){
String m = "00000000";
int c = str.length()%8;
if(c != 0){
str = str+m.substring(c);
}
for(int i=0;i<str.length();i = i+8){
System.out.println(str.substring(i,i+8));
}
}
}
}
}
print('Hello world!')