/**
 * This function finds the index of the last occurrence of the given substring in a string.
 * If the substring is not found, it returns -1.
 */
fun findSubstring(string: String, substr: String): Int {

    // Reverse the given string
    val reversedString = string.reversed()

    // Find the index of the last occurrence of the reversed substring
    val index = reversedString.indexOf(substr.reversed())

    // If the reversed substring is not found, return -1
    if (index == -1) {
        return -1
    }

    // Calculate the index of the last occurrence of the substring in the original string
    val lastIndex = string.length - index - substr.length

    return lastIndex
}
/**
 * This function finds the index of the last occurrence of the given substring in a string.
 * If the substring is not found, it returns -1.
 */
fun findSubstring(string: String, substr: String): Int {
/**
 * This function finds the index of the last occurrence of the given substring in a string.
 * If the substring is not found, it returns -1.
 */
fun findSubstring(string: String, substr: String): Int {

    // Reverse the given string
    val reversedString = string.reversed()

    // Find the index of the last occurrence of the reversed substring
    val index = reversedString.indexOf(substr.reversed())

    // If the reversed substring is not found, return -1
    if (index == -1) {
        return -1
    }

    // Calculate the index of the last occurrence of the substring in the original string
    val lastIndex = string.length - index - substr.length

    return lastIndex
}