pub fn hamming_distance(str1: &str, str2: &str) -> usize {
    let len1 = str1.len();

    // The strings must be the same length.
    if len1 != str2.len() {
        return usize::max_value();
    }

    let mut distance = 0;

    let str1_bytes = str1.as_bytes();
    let str2_bytes = str2.as_bytes();
    
    for i in 0..len1 {
        if str1_bytes[i] != str2_bytes[i] {
            distance = distance + 1;
        }
    }

    distance
}
/// Computes the Hamming distance of the two strings.
Computes the Hamming distance of the two strings.
Computes the Hamming distance of the two strings .
pub fn hamming_distance(str1: &str, str2: &str) -> usize {
    let len1 = str1.len();
    // The strings must be the same length.
    if len1 != str2.len() {
        return usize::max_value();
    }
    let mut distance = 0;
    let str1_bytes = str1.as_bytes();
    let str2_bytes = str2.as_bytes();
    for i in 0..len1 {
        if str1_bytes[i] != str2_bytes[i] {
            distance = distance + 1;
        }
    }
    distance
}
pub fn hamming_distance ( str1 : & str , str2 : & str ) -> usize { let len1 = str1 . len ( ) ; // The strings must be the same length. if len1 != str2 . len ( ) { return usize :: max_value ( ) ; } let mut distance = 0 ; let str1_bytes = str1 . as_bytes ( ) ; let str2_bytes = str2 . as_bytes ( ) ; for i in 0 .. len1 { if str1_bytes [ i ] != str2_bytes [ i ] { distance = distance + 1 ; } } distance }
Computes the Hamming distance of the two strings.
Computes the Hamming distance of the two strings .
str1
&str
str2
&str