CollectionsString, &str & Vec<T>
All courses

Heap strings and growable arrays

String owns UTF-8 text. &str borrows a slice. Vec<T> is a growable array — use vec! macro or Vec::new() + push.

Best practice: Accept &str in APIs; return String when allocating.

Output
Press Run to execute your code.