/**
 * The function finds the characters in a string that are causing a given error at the specific index.
 *
 * @param string The input string.
 * @param errorIndex The index at which the error occurs.
 * @return A list of characters that are causing the error at the given index.
 */
fun findErrorCharacters(string: String, errorIndex: Int): List<Char> {

    val errorCharacters = mutableListOf<Char>()

    // Loop through each character in the string
    for (charIndex in string.indices) {
        // Skip the error index
        if (charIndex == errorIndex) {
            continue
        }

        // Try to execute the code
        try {
            // Use the character at the current index
            val char = string[charIndex]
        } catch (e: IndexOutOfBoundsException) {
            // Handle the index error
            errorCharacters.add(string[charIndex])
        }
    }

    return errorCharacters
}
/**
 * The function finds the characters in a string that are causing a given error at the specific index.
 *
 * @param string The input string.
 * @param errorIndex The index at which the error occurs.
 * @return A list of characters that are causing the error at the given index.
 */
fun findErrorCharacters(string: String, errorIndex: Int): List<Char> {
/**
 * The function finds the characters in a string that are causing a given error at the specific index.
 *
 * @param string The input string.
 * @param errorIndex The index at which the error occurs.
 * @return A list of characters that are causing the error at the given index.
 */
fun findErrorCharacters(string: String, errorIndex: Int): List<Char> {

    val errorCharacters = mutableListOf<Char>()

    // Loop through each character in the string
    for (charIndex in string.indices) {
        // Skip the error index
        if (charIndex == errorIndex) {
            continue
        }

        // Try to execute the code
        try {
            // Use the character at the current index
            val char = string[charIndex]
        } catch (e: IndexOutOfBoundsException) {
            // Handle the index error
            errorCharacters.add(string[charIndex])
        }
    }

    return errorCharacters
}