fn main() { let mut n = String::new(); std::io::stdin().read_line(&mut n).ok(); let n: usize = n.trim().parse().unwrap(); let mut d = String::new(); std::io::stdin().read_line(&mut d).ok(); let d = d.trim().chars().collect::>(); let target = "AGCT"; let cnt = d.iter().filter(|&&c| target.contains(c)).count(); if cnt == 0 { println!("0"); return; } let ends = d.iter().enumerate().skip(cnt-1).filter(|&(_, &c)| target.contains(c)).map(|(i, _)| i).collect::>(); if ends.is_empty() { println!("{}", cnt); } else { println!("{}", ends[ends.len()-1] + 1); } }