/**
 * This function helps the farmer to remove insects from crops using a while loop.
 *
 * @param farmer The name of the farmer.
 * @param crops The list of crops infested with insects.
 * @return A list of crops without any insects.
 */
fun removeInsects(farmer: String, crops: MutableList<String>): List<String> {

    println("Farmer $farmer is removing insects from crops...")
    println("Before removing insects: $crops")

    var index = 0
    var count = 0

    while (index < crops.size) {
        if (crops[index] == "insect") {
            crops.removeAt(index)
            count++
        } else {
            index++
        }
    }

    println("After removing insects: $crops")
    println("The farmer removed $count insects from the crops.")

    return crops
}
/**
 * This function helps the farmer to remove insects from crops using a while loop.
 *
 * @param farmer The name of the farmer.
 * @param crops The list of crops infested with insects.
 * @return A list of crops without any insects.
 */
fun removeInsects(farmer: String, crops: MutableList<String>): List<String> {
/**
 * This function helps the farmer to remove insects from crops using a while loop.
 *
 * @param farmer The name of the farmer.
 * @param crops The list of crops infested with insects.
 * @return A list of crops without any insects.
 */
fun removeInsects(farmer: String, crops: MutableList<String>): List<String> {

    println("Farmer $farmer is removing insects from crops...")
    println("Before removing insects: $crops")

    var index = 0
    var count = 0

    while (index < crops.size) {
        if (crops[index] == "insect") {
            crops.removeAt(index)
            count++
        } else {
            index++
        }
    }

    println("After removing insects: $crops")
    println("The farmer removed $count insects from the crops.")

    return crops
}