Exerpad
🔥0
0 XP
Lv.1 Beginner
Log In

Letter Counter

Count the number of letters (not spaces) in the string "hello world" and print the result.

Expected output:

text
Letters: 10

Hints:

  • Use for ch in "hello world".chars() to loop through each character
  • Use if ch != ' ' to skip spaces
  • Keep a let mut count = 0; and add 1 for each non-space character
rust
fn main() {
}