fn main() {
let s = "Rust is fast and memory-efficient: with no garbage collector";
let character_to_find = 'o';
if let Some(index) = s.rfind(character_to_find) {
println!("The last occurrence of '{}' is at index {}", character_to_find, index);
} else {
println!("Character '{}' not found in the string", character_to_find);
}
}
/*
run:
The last occurrence of 'o' is at index 58
*/