Lifetime elision with one input reference vs. two

Both functions below take &str and return &str with no explicit lifetime annotations. Which one(s) compile as written?

main.rs
// (1)
fn first_word(s: &str) -> &str {
    s.split_whitespace().next().unwrap_or("")
}

// (2)
fn longer(a: &str, b: &str) -> &str {
    if a.len() >= b.len() { a } else { b }
}

5 of 53 in Rust