题解 | #字符串分隔#
字符串分隔
https://www.nowcoder.com/practice/d9162298cb5a437aad722fccccaae8a7
use std::io::{self, *}; fn main() { let stdin = io::stdin(); let mut handle = stdin.lock().lines(); let mut line = handle.next().unwrap().unwrap(); while line.len() > 8 { println!("{}", &line[0..8]); line = line[8..].to_string(); } for i in 0..(8 - line.len()) { line += "0"; } println!("{}", line); }
华为机试题库Rust版本 文章被收录于专栏
华为机试题库Rust版本