/**
 * Given a sentence and a list of replacements, this function replaces the words in the sentence
 * at the specified indices with the corresponding replacements. The function uses short-circuiting
 * to ensure efficient execution.
 *
 * @param sentence The original sentence
 * @param replacements A list of words to be used as replacements
 * @param replacementsIndex A list of indices specifying the positions to be replaced
 * @return The fixed sentence with replacements applied at specific indices
 */
fun getFixedSentence(sentence: String, replacements: List<String>, replacementsIndex: List<Int>): String {

    val words = sentence.split(" ").toMutableList()
    for (i in words.indices) {
        words[i] = if (replacementsIndex[i] < replacements.size) replacements[replacementsIndex[i]] else words[i]
    }
    return words.joinToString(" ")
}
/**
 * Given a sentence and a list of replacements, this function replaces the words in the sentence
 * at the specified indices with the corresponding replacements. The function uses short-circuiting
 * to ensure efficient execution.
 *
 * @param sentence The original sentence
 * @param replacements A list of words to be used as replacements
 * @param replacementsIndex A list of indices specifying the positions to be replaced
 * @return The fixed sentence with replacements applied at specific indices
 */
fun getFixedSentence(sentence: String, replacements: List<String>, replacementsIndex: List<Int>): String {
/**
 * Given a sentence and a list of replacements, this function replaces the words in the sentence
 * at the specified indices with the corresponding replacements. The function uses short-circuiting
 * to ensure efficient execution.
 *
 * @param sentence The original sentence
 * @param replacements A list of words to be used as replacements
 * @param replacementsIndex A list of indices specifying the positions to be replaced
 * @return The fixed sentence with replacements applied at specific indices
 */
fun getFixedSentence(sentence: String, replacements: List<String>, replacementsIndex: List<Int>): String {

    val words = sentence.split(" ").toMutableList()
    for (i in words.indices) {
        words[i] = if (replacementsIndex[i] < replacements.size) replacements[replacementsIndex[i]] else words[i]
    }
    return words.joinToString(" ")
}