题解 | #字符串分隔#
字符串分隔
http://www.nowcoder.com/practice/d9162298cb5a437aad722fccccaae8a7
package main
import (
"fmt"
)
func main () {
var (
strs string
err error
)
// 循环每行读取
_, err = fmt.Scan(&strs)
for ;err==nil; {
for {
li := make([]byte, 0)
for i:=0; i<8; i++ {
if i<len(strs) {
li = append(li, strs[i])
} else {
li = append(li, '0')
}
}
fmt.Println(string(li))
if len(strs)>8 {
strs = strs[8:]
} else {
break
}
}
_, err = fmt.Scan(&strs)
}
}