use crate::diff::diff; mod matrix; mod lcs; mod diff; fn main() { let a = "abcabba\nlkajsdfasdf\nasdfasdfasdf\nlasjkdf"; let b = "abcabba\ncbabasdfasdf\nlasjkdf"; diff(a, b); // lcs(a, b); } // fn lcs(a: &str, b: &str) { // let n = a.len() as i32; // let m = b.len() as i32; // let max = n + m; // let mut endpoints = vec![0i32; max as usize * 2]; // // for script_length in 0..max { // let mut k = -script_length; // while k <= script_length * 2 { // let index = (k + max) as usize + 1; // let previous_endpoint = endpoints[index - 1]; // let next_endpoint = endpoints[index + 1]; // // let mut x = if k == -script_length || k != script_length && previous_endpoint < next_endpoint { // next_endpoint // } else { // previous_endpoint + 1 // }; // // let mut y = if k < x { // x - k // } else { // 0 // }; // // // Increase x and y as long as we are in a common sequence between a and b // while x < n && y < m { // let ac = a.chars().nth(x as usize).unwrap(); // let bc = b.chars().nth(y as usize).unwrap(); // // if ac != bc { // break; // } // // x += 1; // y += 1; // } // // endpoints[index] = x; // // // We have traveled through both strings, the length of the shortest edit script (SES) has been found. // if x >= n && y >= m { // println!("Length of a SES is D ({d})"); // return; // } // // k += 2; // } // } // // println!("Length of a SES is greater than MAX ({max})"); // }