fn combined_similar_id(inputs: &Vec<String>) -> String {
    // Iterate over the inputs for the left side of the comparison.
    for x in 0..inputs.len() {
        // Iterate over the input for the right side of the comparison.
        for y in 0..inputs.len() {
            // Don't compare an ID to itself.
            if x == y { continue; }
            let mut differences: u8 = 0; // Number of different characters in ID.
            let mut final_id: String = String::new(); // Letter that is different between the IDs.

            // Get the chars within the left side ID.
            let mut id_x_chars = inputs[x].chars();
            // Get the chars within the right side ID.
            let mut id_y_chars = inputs[y].chars();

            // Iterate over the letters in the ID. Luckily all IDs are the same length so we don't need to worry about our counter too much.
            for _letter in inputs[x].chars().enumerate() {
                // Get the current character being iterated over on both sides.
                let id_x_char = id_x_chars.next().unwrap();
                let id_y_char = id_y_chars.next().unwrap();

                // Check if the characters are the same.
                if id_x_char != id_y_char {
                    // Iterate the difference counter.
                    differences += 1;
                } else {
                    // Add the matching characters to the final ID to be returned at the end.
                    final_id.push(id_x_char);
                }
            }

            // Check if the difference is 1, luckily no IDs matched exactly so that check was left out.
            if differences < 2 {
                return final_id;
            }
        }
    }

    // Output that no valid output was found from the input.
    "No similar ID combination found. :(".to_string()
}
// Find two IDs that vary by only one letter difference and return a combined string with the mismatch character removed.
Find two IDs that vary by only one letter difference and return a combined string with the mismatch character removed.
Find two IDs that vary by only one letter difference and return a combined string with the mismatch character removed .
fn combined_similar_id(inputs: &Vec<String>) -> String {
    // Iterate over the inputs for the left side of the comparison.
    for x in 0..inputs.len() {
        // Iterate over the input for the right side of the comparison.
        for y in 0..inputs.len() {
            // Don't compare an ID to itself.
            if x == y { continue; }
            let mut differences: u8 = 0; // Number of different characters in ID.
            let mut final_id: String = String::new(); // Letter that is different between the IDs.
            // Get the chars within the left side ID.
            let mut id_x_chars = inputs[x].chars();
            // Get the chars within the right side ID.
            let mut id_y_chars = inputs[y].chars();
            // Iterate over the letters in the ID. Luckily all IDs are the same length so we don't need to worry about our counter too much.
            for _letter in inputs[x].chars().enumerate() {
                // Get the current character being iterated over on both sides.
                let id_x_char = id_x_chars.next().unwrap();
                let id_y_char = id_y_chars.next().unwrap();
                // Check if the characters are the same.
                if id_x_char != id_y_char {
                    // Iterate the difference counter.
                    differences += 1;
                } else {
                    // Add the matching characters to the final ID to be returned at the end.
                    final_id.push(id_x_char);
                }
            }
            // Check if the difference is 1, luckily no IDs matched exactly so that check was left out.
            if differences < 2 {
                return final_id;
            }
        }
    }
    // Output that no valid output was found from the input.
    "No similar ID combination found. :(".to_string()
}
fn combined_similar_id ( inputs : & Vec < String > ) -> String { // Iterate over the inputs for the left side of the comparison. for x in 0 .. inputs . len ( ) { // Iterate over the input for the right side of the comparison. for y in 0 .. inputs . len ( ) { // Don't compare an ID to itself. if x == y { continue ; } let mut differences : u8 = 0 ; // Number of different characters in ID. let mut final_id : String = String :: new ( ) ; // Letter that is different between the IDs. // Get the chars within the left side ID. let mut id_x_chars = inputs [ x ] . chars ( ) ; // Get the chars within the right side ID. let mut id_y_chars = inputs [ y ] . chars ( ) ; // Iterate over the letters in the ID. Luckily all IDs are the same length so we don't need to worry about our counter too much. for _letter in inputs [ x ] . chars ( ) . enumerate ( ) { // Get the current character being iterated over on both sides. let id_x_char = id_x_chars . next ( ) . unwrap ( ) ; let id_y_char = id_y_chars . next ( ) . unwrap ( ) ; // Check if the characters are the same. if id_x_char != id_y_char { // Iterate the difference counter. differences += 1 ; } else { // Add the matching characters to the final ID to be returned at the end. final_id . push ( id_x_char ) ; } } // Check if the difference is 1, luckily no IDs matched exactly so that check was left out. if differences < 2 { return final_id ; } } } // Output that no valid output was found from the input. " " . to_string ( ) }
Find two IDs that vary by only one letter difference and return a combined string with the mismatch character removed.
Find two IDs that vary by only one letter difference and return a combined string with the mismatch character removed .
inputs
&Vec<String>
inputs
&Vec<String>