题解 | #字符串分隔#
字符串分隔
http://www.nowcoder.com/practice/d9162298cb5a437aad722fccccaae8a7
分享一个很呆瓜的答案
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
String into = sc.next();
int L = into.length();
int L8 = (L%8 == 0) ? L : (L/8 + 1)*8;
int add = L8 - L;
int key = 0;
for(int i = 0 ; i<L8 ;i++){
if(i < L && key < L8 / 8){
System.out.print(into.charAt(i));
if((i+1)%8 == 0 ){
System.out.println("");
key++;
}
}else{
System.out.print("0");
}
}
}
}