/**
 * This function takes a list of actors/actresses and a name as input.
 * The function modifies the actor list by removing all occurrences of the provided name using indexing and a while loop.
 *
 * @param actorList A list of actors/actresses (e.g., ["Tom Hanks", "Julia Roberts", "Tom Cruise", "Brad Pitt", "Tom Hardy"])
 * @param name The name of the actor/actress to be removed from the list (e.g., "Tom")
 * @return The modified actorList with all occurrences of the provided name removed.
 */
fun modifyActorList(actorList: MutableList<String>, name: String): MutableList<String> {

    var index = 0
    while (index < actorList.size) {
        if (actorList[index].contains(name)) {
            actorList.removeAt(index)
        } else {
            index++
        }
    }
    return actorList
}
/**
 * This function takes a list of actors/actresses and a name as input.
 * The function modifies the actor list by removing all occurrences of the provided name using indexing and a while loop.
 *
 * @param actorList A list of actors/actresses (e.g., ["Tom Hanks", "Julia Roberts", "Tom Cruise", "Brad Pitt", "Tom Hardy"])
 * @param name The name of the actor/actress to be removed from the list (e.g., "Tom")
 * @return The modified actorList with all occurrences of the provided name removed.
 */
fun modifyActorList(actorList: MutableList<String>, name: String): MutableList<String> {
/**
 * This function takes a list of actors/actresses and a name as input.
 * The function modifies the actor list by removing all occurrences of the provided name using indexing and a while loop.
 *
 * @param actorList A list of actors/actresses (e.g., ["Tom Hanks", "Julia Roberts", "Tom Cruise", "Brad Pitt", "Tom Hardy"])
 * @param name The name of the actor/actress to be removed from the list (e.g., "Tom")
 * @return The modified actorList with all occurrences of the provided name removed.
 */
fun modifyActorList(actorList: MutableList<String>, name: String): MutableList<String> {

    var index = 0
    while (index < actorList.size) {
        if (actorList[index].contains(name)) {
            actorList.removeAt(index)
        } else {
            index++
        }
    }
    return actorList
}