Maximum Number of Balloons LeetCode solution in Rust
1impl Solution {2pub fn max_number_of_balloons(text: String) -> i32 {3use std::collections::HashMap;45let mut counter: HashMap<char, i32> = "balloon".chars().map(|c| (c, 0)).collect();67text.chars().for_each(|c| {8counter.entry(c).and_modify(|e| *e += 1);9});1011counter12.iter()13.map(|(&c, &num)| num / if "lo".contains(c) { 2 } else { 1 })14.min()15.unwrap()16}17}