/**
 * This function aims to find all occurrences of a specific letter in a string
 * and return the absolute value of the difference between the last and first index in which the character was found.
 */
fun findCharacters(string: String, letter: Char): Int {

    var firstIndex: Int? = null
    var lastIndex: Int? = null

    string.forEachIndexed { index, char ->
        if (char == letter) {
            if (firstIndex == null) {
                firstIndex = index
            }
            lastIndex = index
        }
    }

    val difference = Math.abs(lastIndex!! - firstIndex!!)
    return difference
}
/**
 * This function aims to find all occurrences of a specific letter in a string
 * and return the absolute value of the difference between the last and first index in which the character was found.
 */
fun findCharacters(string: String, letter: Char): Int {
/**
 * This function aims to find all occurrences of a specific letter in a string
 * and return the absolute value of the difference between the last and first index in which the character was found.
 */
fun findCharacters(string: String, letter: Char): Int {

    var firstIndex: Int? = null
    var lastIndex: Int? = null

    string.forEachIndexed { index, char ->
        if (char == letter) {
            if (firstIndex == null) {
                firstIndex = index
            }
            lastIndex = index
        }
    }

    val difference = Math.abs(lastIndex!! - firstIndex!!)
    return difference
}