/**
 * This function takes a list of addresses and a target address as input.
 * It modifies the list by removing the target address if it exists in the list.
 * The function returns the modified list.
 *
 * Example:
 * addresses = ["123 Main St", "456 Elm St", "789 Oak St"]
 * target_address = "123 Main St"
 * searchAddress(addresses, target_address) -> ["456 Elm St", "789 Oak St"]
 */
fun searchAddress(addresses: MutableList<String>, targetAddress: String): List<String> {

    val iterator = addresses.iterator()
    while (iterator.hasNext()) {
        if (iterator.next() == targetAddress) {
            iterator.remove()
        }
    }
    return addresses
}
/**
 * This function takes a list of addresses and a target address as input.
 * It modifies the list by removing the target address if it exists in the list.
 * The function returns the modified list.
 *
 * Example:
 * addresses = ["123 Main St", "456 Elm St", "789 Oak St"]
 * target_address = "123 Main St"
 * searchAddress(addresses, target_address) -> ["456 Elm St", "789 Oak St"]
 */
fun searchAddress(addresses: MutableList<String>, targetAddress: String): List<String> {
/**
 * This function takes a list of addresses and a target address as input.
 * It modifies the list by removing the target address if it exists in the list.
 * The function returns the modified list.
 *
 * Example:
 * addresses = ["123 Main St", "456 Elm St", "789 Oak St"]
 * target_address = "123 Main St"
 * searchAddress(addresses, target_address) -> ["456 Elm St", "789 Oak St"]
 */
fun searchAddress(addresses: MutableList<String>, targetAddress: String): List<String> {

    val iterator = addresses.iterator()
    while (iterator.hasNext()) {
        if (iterator.next() == targetAddress) {
            iterator.remove()
        }
    }
    return addresses
}