fn build_char_frequency_table(phrase: &str) -> Vec<i32> {
    const Z: i32 = 'z' as i32;
    const A: i32 = 'a' as i32;
    let mut table: Vec<i32> = vec![-1; (Z - A + 1) as usize];

    phrase.chars().for_each(|c| {
        let x = get_char_number(c);

        if x != -1 {
            table[x as usize] += 1;
        }
    });

    table.to_vec()
}
/// Count how many times each character appears
Count how many times each character appears
Count how many times each character appears
fn build_char_frequency_table(phrase: &str) -> Vec<i32> {
    const Z: i32 = 'z' as i32;
    const A: i32 = 'a' as i32;
    let mut table: Vec<i32> = vec![-1; (Z - A + 1) as usize];
    phrase.chars().for_each(|c| {
        let x = get_char_number(c);
        if x != -1 {
            table[x as usize] += 1;
        }
    });
    table.to_vec()
}
fn build_char_frequency_table ( phrase : & str ) -> Vec < i32 > { const Z : i32 = 'z' as i32 ; const A : i32 = 'a' as i32 ; let mut table : Vec < i32 > = vec ! [ 1 ( Z A 1 ) as usize ] ; phrase . chars ( ) . for_each ( | c | { let x = get_char_number ( c ) ; if x != - 1 { table [ x as usize ] += 1 ; } } ) ; table . to_vec ( ) }
Count how many times each character appears
Count how many times each character appears
phrase
&str
phrase
&str