26 lines
777 B
Rust
26 lines
777 B
Rust
fn process(input: &str) -> (String, u32) {
|
|
let num_changes = 0;
|
|
let mut peekables = input.chars().peekable();
|
|
while let Some(current_char) = peekables.next() {
|
|
println!("Checking {current_char} and {}", peekables.next().unwrap());
|
|
}
|
|
|
|
(String::new(), num_changes)
|
|
}
|
|
|
|
fn process_recursively(input: &str) -> String {
|
|
let mut working_str = input;
|
|
println!("RECURSIVE START: {}", input.len());
|
|
let mut need_again = true;
|
|
while need_again {
|
|
let (working, last_count) = process(working_str);
|
|
if last_count > 0 { need_again = true; }
|
|
let w2 = working.clone();
|
|
working_str = w2.as_str();
|
|
}
|
|
"dabCBAcaDA".to_string()
|
|
}
|
|
|
|
fn main() {
|
|
assert_eq!(process_recursively("dabAcCaCBAcCcaDA"), "dabCBAcaDA");
|
|
} |