1 2 3 4 5 6 7
#[macro_export] macro_rules! scanf { ( $string:expr, $sep:expr, $( $x:ty ),+ ) => {{ let mut iter = $string.split($sep); ($(iter.next().and_then(|word| word.parse::<$x>().ok()),)*) }} }