fn gcd(a: usize, b: usize) -> usize { if b == 0 { return a; } gcd(b, a%b) } fn main() { let mut x = String::new(); std::io::stdin().read_line(&mut x).ok(); let x = x.trim(); let val = x.split(".").collect::>(); if val.len() == 1 { println!("{}/1", val[0]); return; } let num = val[0].parse::().unwrap() * 10usize.pow(val[1].len() as u32) + val[1].parse::().unwrap(); let denom = 10usize.pow(val[1].len() as u32); let gcdval = gcd(num, denom); println!("{}/{}", num/gcdval, denom/gcdval); }