1 use std::{error::Error, io, process}; 2 run() -> Result<u64, Box<dyn Error>>3fn run() -> Result<u64, Box<dyn Error>> { 4 let mut rdr = csv::Reader::from_reader(io::stdin()); 5 6 let mut count = 0; 7 for result in rdr.records() { 8 let record = result?; 9 if &record[0] == "us" && &record[3] == "MA" { 10 count += 1; 11 } 12 } 13 Ok(count) 14 } 15 main()16fn main() { 17 match run() { 18 Ok(count) => { 19 println!("{}", count); 20 } 21 Err(err) => { 22 println!("{}", err); 23 process::exit(1); 24 } 25 } 26 } 27