You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: 0072-edit-distance.rs
    path of file: ./repos/NeetCode-Solutions/14_2-D_Dynamic_Programming/09_Edit_Distance
    
    the code of the file until where you have to start completion: /*
Problem: LeetCode 72 - Edit Distance

Key Idea:
The key idea is to use dynamic programming to find the minimum number of operations (insert, delete, or replace) required to convert one string into another.

Approach:
1. Initialize a 2D vector `dp` of size `(m+1) x (n+1)`, where `dp[i][j]` represents the 
    
    pub fn min_distance(word1: String, word2: String) -> i32 {
        let word1_chars: Vec<char> = word1.chars().collect();
        let word2_chars: Vec<char> = word2.chars().collect();
        let m = word1_chars.len();
        let n = word2_chars.len();

        let mut dp = vec![vec![0; n + 1]; m + 1];

        // Initialize the first row and first column
        for i in 0..=m {
            dp[i][0] = i;
        }
        for j in 0..=n {
            dp[0][j] = j;
        }

        for i in 1..=m {
            for j in 1..=n {
                if word1_chars[i - 1] == word2_chars[j - 1] {
                    dp[i][j] = dp[i - 1][j - 1];
                } else {
                    dp[i][j] = 1 + dp[i - 1][j - 1].min(dp[i][j - 1].min(dp[i - 1][j]));
                }
            }
        }

        dp[m][n] as i32
    }