Exerpad
🔥 0
0 XP
Exercise 8 · Chapter: StringsOptional+50 XP

Word Counter

Count how many words are in the sentence "Rust is fun and fast" by splitting on spaces. Print the count.

Expected output:

5

Hints:

  • Use .split(' ') to break the string into pieces at each space
  • Use .count() to count how many pieces there are
rust
fn main() {
}
Output
Run your code to see the output here.