fn main() { let input: Vec = read_vec(); let mut output: usize = 0; if input[1] - input[0] + 1 < input[2] { output = input[1] - input[0] + 1; } else { output = input[2]; } println!("{:?}", output); } fn read_vec() -> Vec { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); s.trim().split_whitespace() .map(|e| e.parse().ok().unwrap()).collect() }