This commit is contained in:
Jasper Ras 2026-02-21 11:50:20 +01:00
parent e1246d346d
commit 2f6caa57f0
6 changed files with 72 additions and 0 deletions

View file

@ -0,0 +1,22 @@
use std::io;
fn longest<'a>(x: &'a str, y: &'a str) -> &'a str {
if x.len() > y.len() { x } else { y }
}
fn brap<'b>(x: &'b str, y: &str) -> &'b str {
if x.len() > y.len() { x } else { "henkieeeeee" }
}
fn main() {
let stronk = String::from("stronkman");
let ln;
{
let stonks = "stonks";
let mut inp = String::new();
io::stdin().read_line(&mut inp).expect("Please input a name");
ln = longest(&inp, brap(stronk.as_str(), stonks));
}
println!("The longest of them all: {}", ln);
}