use std::io;
use std::str::FromStr;
use std::cmp::Ordering;
fn get_number(prompt_input: &str) -> u32 {
println!("{}", prompt_input);
let mut input = String::new();
io::stdin().read_line(&mut input).expect("no input!");
u32::from_str(input.trim()).unwrap()
}
fn main() {
let a = get_number("Enter first number a = ");
let b = get_number("Enter first number b = ");
println!("The Greatest Common Divisor of {} and {} is {}", a, b, euclid( a, b) );
}
fn euclid(a: u32, b: u32) -> u32 {
match a.cmp(&b) {
Ordering::Equal => b,
Ordering::Less => euclid(a,b-a),
Ordering::Greater => euclid(a-b,b)
}
}
dXNlIHN0ZDo6aW87CnVzZSBzdGQ6OnN0cjo6RnJvbVN0cjsKdXNlIHN0ZDo6Y21wOjpPcmRlcmluZzsKCmZuIGdldF9udW1iZXIocHJvbXB0X2lucHV0OiAmc3RyKSAtPiB1MzIgewoKICAgICAgIHByaW50bG4hKCJ7fSIsIHByb21wdF9pbnB1dCk7CiAgICAgICAKICAgICAgIGxldCBtdXQgaW5wdXQgPSBTdHJpbmc6Om5ldygpOwogICAgICAgCiAgICAgICBpbzo6c3RkaW4oKS5yZWFkX2xpbmUoJm11dCBpbnB1dCkuZXhwZWN0KCJubyBpbnB1dCEiKTsgICAgIAogICAgICAgCiAgICAgICB1MzI6OmZyb21fc3RyKGlucHV0LnRyaW0oKSkudW53cmFwKCkgICAgICAKfQoKZm4gbWFpbigpIHsKICAgICAKICAgICAgIGxldCBhID0gZ2V0X251bWJlcigiRW50ZXIgZmlyc3QgbnVtYmVyIGEgPSAiKTsKICAgICAgIAogICAgICAgbGV0IGIgPSBnZXRfbnVtYmVyKCJFbnRlciBmaXJzdCBudW1iZXIgYiA9ICIpOwoKICAgICAgIHByaW50bG4hKCJUaGUgR3JlYXRlc3QgQ29tbW9uIERpdmlzb3Igb2Yge30gYW5kIHt9IGlzIHt9IiwgYSwgYiwgZXVjbGlkKCBhLCBiKSApOyAgICAgICAKfQoKZm4gZXVjbGlkKGE6IHUzMiwgYjogdTMyKSAtPiB1MzIgewogCiAgIGFzc2VydCEoYSA+IDAgJiYgYiA+IDApOwogICAKICAgbWF0Y2ggYS5jbXAoJmIpIHsKICAgCiAgICAgIE9yZGVyaW5nOjpFcXVhbCA9PiBiLAogICAgICAKICAgICAgT3JkZXJpbmc6Okxlc3MgPT4gZXVjbGlkKGEsYi1hKSwKICAgICAgCiAgICAgIE9yZGVyaW5nOjpHcmVhdGVyID0+IGV1Y2xpZChhLWIsYikKICAgfSAgIAp9