/**
 * Chef [chefName] wants to chop the carrots in the given set.
 *
 * The chef needs to loop through the given set of carrots and chop each carrot into smaller pieces.
 *
 * @param chefName Name of the chef.
 * @param carrots Set of carrots to be chopped.
 * @return A set containing the chopped carrots.
 *
 * Example:
 * chopCarrots("Gordon", setOf("Carrot A", "Carrot B", "Carrot C"))
 */
fun chopCarrots(chefName: String, carrots: MutableSet<String>): Set<String> {

    val choppedCarrots = mutableSetOf<String>()
    
    // Loop through each carrot in the given set
    val iterator = carrots.iterator()
    while (iterator.hasNext()) {
        val carrot = iterator.next()
        
        // Removing the carrot from the original set
        iterator.remove()
        
        // Chef chopping the carrot into smaller pieces
        choppedCarrots.add("Chopped $carrot")
        
        // Chef wants to use the smaller pieces, so adding them back to the original set
        carrots.add("Chopped $carrot")
    }
    
    return choppedCarrots
}
/**
 * Chef [chefName] wants to chop the carrots in the given set.
 *
 * The chef needs to loop through the given set of carrots and chop each carrot into smaller pieces.
 *
 * @param chefName Name of the chef.
 * @param carrots Set of carrots to be chopped.
 * @return A set containing the chopped carrots.
 *
 * Example:
 * chopCarrots("Gordon", setOf("Carrot A", "Carrot B", "Carrot C"))
 */
fun chopCarrots(chefName: String, carrots: MutableSet<String>): Set<String> {
/**
 * Chef [chefName] wants to chop the carrots in the given set.
 *
 * The chef needs to loop through the given set of carrots and chop each carrot into smaller pieces.
 *
 * @param chefName Name of the chef.
 * @param carrots Set of carrots to be chopped.
 * @return A set containing the chopped carrots.
 *
 * Example:
 * chopCarrots("Gordon", setOf("Carrot A", "Carrot B", "Carrot C"))
 */
fun chopCarrots(chefName: String, carrots: MutableSet<String>): Set<String> {

    val choppedCarrots = mutableSetOf<String>()
    
    // Loop through each carrot in the given set
    val iterator = carrots.iterator()
    while (iterator.hasNext()) {
        val carrot = iterator.next()
        
        // Removing the carrot from the original set
        iterator.remove()
        
        // Chef chopping the carrot into smaller pieces
        choppedCarrots.add("Chopped $carrot")
        
        // Chef wants to use the smaller pieces, so adding them back to the original set
        carrots.add("Chopped $carrot")
    }
    
    return choppedCarrots
}