use std::io::{self, Write}; use day27::task_scheduler; fn main() { let mut buffer = String::new(); print!("Insert the task as a unique string: "); io::stdout().flush().expect("Failed to flush"); io::stdin() .read_line(&mut buffer) .expect("Failed to read line"); let tasks: Vec = buffer.trim().chars().collect(); buffer = String::new(); print!("Insert the length of the coldown: "); io::stdout().flush().expect("Failed to flush"); io::stdin() .read_line(&mut buffer) .expect("Failed to read line"); let coldown = buffer .trim() .parse() .expect("Coldown must be a valid unsigned integer"); let result = task_scheduler(&tasks, coldown); println!("The least number of units of times that the CPU will take to finish all the given tasks is {}", result); }