← Back to archive

Stdle #18 · ownership · 2026-06-24

What does this Rust snippet output?

A past puzzle — fully playable. 4 attempts, hints on wrong guesses.

fn main() {
let words = vec![String::from("a"), String::from("bb")];
let lens: Vec<usize> =
words.into_iter().map(|w| w.len()).collect();
println!("{:?}", lens);
}
Ownership
4 attempts left

Answer & explanation