use std::io::Read; fn r(s: &str) -> u32 { if s.len() < 3 { return 0; } match &s[1..2] { "b" => 2, "o" => 8, "x" => 16, _ => 0, } } fn main() { let mut s = String::new(); std::io::stdin().read_to_string(&mut s).ok(); for s in s.lines().skip(1) { println!( "{:?}", match r(s) { 0 => s.parse(), r => u64::from_str_radix(&s[2..], r), } .unwrap() ) } }