25 lines
594 B
Rust
25 lines
594 B
Rust
use std::io::{self, Write};
|
|
|
|
use day26::min_turns;
|
|
|
|
fn read_lock(request: &str) -> String {
|
|
let mut buffer = String::new();
|
|
|
|
print!("{}", request);
|
|
io::stdout().flush().expect("Failed to flush");
|
|
|
|
io::stdin()
|
|
.read_line(&mut buffer)
|
|
.expect("Failed to read line");
|
|
|
|
buffer.trim().to_owned()
|
|
}
|
|
|
|
fn main() {
|
|
let current_lock = read_lock("Insert the current lock: ");
|
|
let target_lock = read_lock("Insert the target lock: ");
|
|
|
|
let result = min_turns(¤t_lock, &target_lock);
|
|
println!("The minimum number of turns required is {}", result);
|
|
}
|