fun main() {
val s = "Kotlin is a cross-platform, general-purpose programming language"
val characterToFind = 'o'
val index = s.lastIndexOf(characterToFind)
if (index != -1) {
println("The last occurrence of '$characterToFind' is at index $index")
} else {
println("Character '$characterToFind' not found in the string")
}
}
/*
run:
The last occurrence of 'o' is at index 46
*/