/**
 * Given an input string, create a tuple from the string and modify a specific element in the list.
 * Modify the element at the specified index to its all lowercase form.
 *
 * @param inputString The input string from which to create the tuple.
 * @param indexToModify The index of the element in the created tuple to modify.
 * @return The modified tuple created from the input string.
 *
 * Example:
 * inputString = "Apple, Banana, Carrot, Durian"
 * indexToModify = 2
 *
 * Returns:
 * ("Apple", "Banana", "carrot", "Durian")
 */
fun farmerCodeCompletion(inputString: String, indexToModify: Int): List<String> {

    // Creating the tuple from the input string
    val fruitsList = inputString.split(", ")

    // Modifying the element at the specified index to lowercase
    val modifiedList = fruitsList.mapIndexed { index, item ->
        if (index == indexToModify) item.toLowerCase() else item
    }

    return modifiedList
}

// Example usage
val inputString = "Apple, Banana, Carrot, Durian"
val indexToModify = 2
val result = farmerCodeCompletion(inputString, indexToModify)
/**
 * Given an input string, create a tuple from the string and modify a specific element in the list.
 * Modify the element at the specified index to its all lowercase form.
 *
 * @param inputString The input string from which to create the tuple.
 * @param indexToModify The index of the element in the created tuple to modify.
 * @return The modified tuple created from the input string.
 *
 * Example:
 * inputString = "Apple, Banana, Carrot, Durian"
 * indexToModify = 2
 *
 * Returns:
 * ("Apple", "Banana", "carrot", "Durian")
 */
fun farmerCodeCompletion(inputString: String, indexToModify: Int): List<String> {
/**
 * Given an input string, create a tuple from the string and modify a specific element in the list.
 * Modify the element at the specified index to its all lowercase form.
 *
 * @param inputString The input string from which to create the tuple.
 * @param indexToModify The index of the element in the created tuple to modify.
 * @return The modified tuple created from the input string.
 *
 * Example:
 * inputString = "Apple, Banana, Carrot, Durian"
 * indexToModify = 2
 *
 * Returns:
 * ("Apple", "Banana", "carrot", "Durian")
 */
fun farmerCodeCompletion(inputString: String, indexToModify: Int): List<String> {

    // Creating the tuple from the input string
    val fruitsList = inputString.split(", ")

    // Modifying the element at the specified index to lowercase
    val modifiedList = fruitsList.mapIndexed { index, item ->
        if (index == indexToModify) item.toLowerCase() else item
    }

    return modifiedList
}

// Example usage
val inputString = "Apple, Banana, Carrot, Durian"
val indexToModify = 2
val result = farmerCodeCompletion(inputString, indexToModify)