use std::io::{self, Read}; fn read_u8(reader: &mut R) -> u8 { reader .by_ref() .bytes() .filter_map(|r| r.ok()) .skip_while(|&b| b < b'0' || b > b'9') .take_while(|&b| b >= b'0' && b <= b'9') .map(|b| b - b'0') .fold(0, |res, i| res * 10 + i) } fn print_fizzbuzz(n: u8) { match (n % 3, n % 5) { (0, 0) => println!("FizzBuzz"), (0, _) => println!("Fizz"), (_, 0) => println!("Buzz"), _ => println!("{}", n), }; } fn main() { let stdin = io::stdin(); let mut stdin = stdin.lock(); let n = read_u8(&mut stdin); for i in 1..n + 1 { print_fizzbuzz(i); } }