fn main() { let mut xx = String::new(); std::io::Read::read_to_string(&mut std::io::stdin(), &mut xx).ok(); let xx: Vec<&str> = xx.split_whitespace().skip(2).collect(); let (a_s, a_t) = (xx[0].matches('A').count(), xx[1].matches('A').count()); let (b_s, b_t) = (xx[0].matches('B').count(), xx[1].matches('B').count()); println!("{}", a_s.min(a_t) + b_s.min(b_t)); }