/**
 * A farmer needs to remove all the pigs from his field.
 * He has two sets, one containing the pigs and another containing the dogs.
 * He wants to use a for loop to iterate through the pig set and remove each pig from the field,
 * but ensure that any dogs in the dog set are not removed.
 *
 * Complete the code below by inserting the appropriate code to remove each pig from the field using a for loop.
 *
 * @param pigSet A set of pigs in the field
 * @param dogSet A set of dogs in the field
 * @return The updated set of pigs in the field after removal
 *
 * Note:
 * - The pig set is not empty initially but may become empty after removing all the pigs.
 * - The dog set may contain elements not related to dogs.
 * - You are not allowed to modify the dog set.
 */
fun removePigsFromField(pigSet: MutableSet<String>, dogSet: Set<String>): MutableSet<String> {

    for (pig in pigSet.toSet()) {
        // Insert code here
        if (pig !in dogSet) {
            pigSet.remove(pig)
        }
    }
    return pigSet
}
/**
 * A farmer needs to remove all the pigs from his field.
 * He has two sets, one containing the pigs and another containing the dogs.
 * He wants to use a for loop to iterate through the pig set and remove each pig from the field,
 * but ensure that any dogs in the dog set are not removed.
 *
 * Complete the code below by inserting the appropriate code to remove each pig from the field using a for loop.
 *
 * @param pigSet A set of pigs in the field
 * @param dogSet A set of dogs in the field
 * @return The updated set of pigs in the field after removal
 *
 * Note:
 * - The pig set is not empty initially but may become empty after removing all the pigs.
 * - The dog set may contain elements not related to dogs.
 * - You are not allowed to modify the dog set.
 */
fun removePigsFromField(pigSet: MutableSet<String>, dogSet: Set<String>): MutableSet<String> {
/**
 * A farmer needs to remove all the pigs from his field.
 * He has two sets, one containing the pigs and another containing the dogs.
 * He wants to use a for loop to iterate through the pig set and remove each pig from the field,
 * but ensure that any dogs in the dog set are not removed.
 *
 * Complete the code below by inserting the appropriate code to remove each pig from the field using a for loop.
 *
 * @param pigSet A set of pigs in the field
 * @param dogSet A set of dogs in the field
 * @return The updated set of pigs in the field after removal
 *
 * Note:
 * - The pig set is not empty initially but may become empty after removing all the pigs.
 * - The dog set may contain elements not related to dogs.
 * - You are not allowed to modify the dog set.
 */
fun removePigsFromField(pigSet: MutableSet<String>, dogSet: Set<String>): MutableSet<String> {

    for (pig in pigSet.toSet()) {
        // Insert code here
        if (pig !in dogSet) {
            pigSet.remove(pig)
        }
    }
    return pigSet
}