/*
* Description : Greatest Common Divisor( Euclid'algorithm ) in Rust languange.
* Author : Adrian Statescu <mergesortv@gmail.com>.
* License : MIT.
*/
fn gcd(mut x: u64, mut y: u64) -> u64 {
while y != 0 {
let t = x % y;
x = y;
y = t;
}
x
}
fn get_input() -> String {
let mut buffer = String::new();
std::io::stdin().read_line(&mut buffer).expect("Failed");
buffer
}
fn main() {
let x = get_input().trim().parse::<u64>().unwrap();
let y = get_input().trim().parse::<u64>().unwrap();
println!("Euclid ({:?}, {:?}) -> {:?}", x, y, gcd(x,y));
}
LyoKICogRGVzY3JpcHRpb24gOiBHcmVhdGVzdCBDb21tb24gRGl2aXNvciggRXVjbGlkJ2FsZ29yaXRobSApIGluIFJ1c3QgbGFuZ3VhbmdlLgogKiBBdXRob3IgICAgICA6IEFkcmlhbiBTdGF0ZXNjdSA8bWVyZ2Vzb3J0dkBnbWFpbC5jb20+LgogKiBMaWNlbnNlICAgICA6IE1JVC4KICovCiAKZm4gZ2NkKG11dCB4OiB1NjQsIG11dCB5OiB1NjQpIC0+IHU2NCB7CgogICBhc3NlcnQhKHggIT0gMCAmJiB5ICE9IDApOwoKICAgd2hpbGUgeSAhPSAwIHsKCiAgIAkgICAgIGxldCB0ID0geCAlIHk7CiAgIAkgICAgIHggPSB5OwogICAJICAgICB5ID0gdDsKICAgfSAgIAogICB4Cn0KCmZuIGdldF9pbnB1dCgpIC0+IFN0cmluZyB7CgogICBsZXQgbXV0IGJ1ZmZlciA9IFN0cmluZzo6bmV3KCk7CgogICBzdGQ6OmlvOjpzdGRpbigpLnJlYWRfbGluZSgmbXV0IGJ1ZmZlcikuZXhwZWN0KCJGYWlsZWQiKTsKCiAgIGJ1ZmZlcgp9CgpmbiBtYWluKCkgewoJCiAgbGV0IHggPSBnZXRfaW5wdXQoKS50cmltKCkucGFyc2U6Ojx1NjQ+KCkudW53cmFwKCk7CiAgbGV0IHkgPSBnZXRfaW5wdXQoKS50cmltKCkucGFyc2U6Ojx1NjQ+KCkudW53cmFwKCk7CiAgCiAgcHJpbnRsbiEoIkV1Y2xpZCAoezo/fSwgezo/fSkgLT4gezo/fSIsIHgsIHksIGdjZCh4LHkpKTsKfSA=