题解 | #字符串分隔#
字符串分隔
http://www.nowcoder.com/practice/d9162298cb5a437aad722fccccaae8a7
while (line = STDIN.gets)
line2 = line.delete("\n")
if line2.length < 8
line_new = line2 + "0"(8-line2.length)
puts line_new
elsif line2.length == 8
puts line2
else
nu = line2.length % 8
line2 += "0"(8-nu) if nu > 0
count = (line2.length / 8).to_i
(0...count).each{|i|
puts line2.slice(i*8, 8)
}
end
end