use std::collections::{BTreeSet, HashMap, HashSet}; use proconio::marker::Chars; fn main() { proconio::input! { s: Chars, } let op_indexes = s .iter() .enumerate() .filter(|(_, c)| !c.is_numeric()) .map(|(i, _)| i) .collect::>(); let mut values: Vec = vec![]; let mut i = 0; for &op_index in op_indexes.iter() { values.push(s[i..op_index].iter().collect::().parse().unwrap()); i = op_index + 1; } values.push(s[i..].iter().collect::().parse().unwrap()); eprintln!("{:?}", values); let mut ans = values[0]; for (i, op) in op_indexes .into_iter() .map(|op_index| s[op_index]) .enumerate() { match op { '+' => ans *= values[i + 1], '*' => ans += values[i + 1], _ => unreachable!(), } } println!("{}", ans); }