fn main() {
    let s = String::from("Hello there");

    let first = first_word(&s[..]);
    println!("First word is: {}", first);
}

fn first_word(s: &str) -> &str {
    let bytes = s.as_bytes();

    for (i, &item) in bytes.iter().enumerate() {
        if item == b' ' {
            return &s[..i];
        }
    }

    &s[..]
}

fn main() {
    let s = String::from("Hello there");

    let first = first_word(&s);
    println!("First word is: {}", first);
}

fn first_word(s: &String) -> &str {
    let bytes = s.as_bytes();

    for (i, &item) in bytes.iter().enumerate() {
        if item == b' ' {
            return &s[..i];
        }
    }

    &s[..]
}

--- 
+++ 
@@ -1,11 +1,11 @@
 fn main() {
     let s = String::from("Hello there");
 
-    let first = first_word(&s[..]);
+    let first = first_word(&s);
     println!("First word is: {}", first);
 }
 
-fn first_word(s: &str) -> &str {
+fn first_word(s: &String) -> &str {
     let bytes = s.as_bytes();
 
     for (i, &item) in bytes.iter().enumerate() {
Rewrite function to accept string slice as param so it can handle Strings and string literals
