fn extract_prefix(s: &str, length_of_prefix: usize) -> &str {
// Extract the prefix
&s[..length_of_prefix]
}
fn main() {
let s = "Software Programmer";
let length_of_prefix = 4; // Length of the prefix you want to extract
let prefix = extract_prefix(s, length_of_prefix);
println!("Prefix: {}", prefix);
}
/*
run:
Prefix: Soft
*/