/**
 * This function takes the name of an actress and a new name as arguments,
 * and modifies the actress name in a specific way using list methods.
 *
 * @param actress The current name of the actress.
 * @param new_name The new name for the actress.
 * @return The modified actress name.
 */
fun modifyActorName(actress: String, newName: String): String {

    // Convert actress name to a list of characters
    val nameList = actress.toList().toMutableList()

    // Iterate over the characters in the new name
    for (char in newName) {
        // Check if the character exists in the name list
        if (char in nameList) {
            // Calculate the index of the first occurrence of the character
            val index = nameList.indexOf(char)
            // Remove the character from the list
            nameList.removeAt(index)
        } else {
            // Append the character to the list
            nameList.add(char)
        }
    }

    // Sort the list of characters in ascending order
    nameList.sort()

    // Join the characters in the list to form the modified name
    val modifiedName = nameList.joinToString("")

    return modifiedName
}
/**
 * This function takes the name of an actress and a new name as arguments,
 * and modifies the actress name in a specific way using list methods.
 *
 * @param actress The current name of the actress.
 * @param new_name The new name for the actress.
 * @return The modified actress name.
 */
fun modifyActorName(actress: String, newName: String): String {
/**
 * This function takes the name of an actress and a new name as arguments,
 * and modifies the actress name in a specific way using list methods.
 *
 * @param actress The current name of the actress.
 * @param new_name The new name for the actress.
 * @return The modified actress name.
 */
fun modifyActorName(actress: String, newName: String): String {

    // Convert actress name to a list of characters
    val nameList = actress.toList().toMutableList()

    // Iterate over the characters in the new name
    for (char in newName) {
        // Check if the character exists in the name list
        if (char in nameList) {
            // Calculate the index of the first occurrence of the character
            val index = nameList.indexOf(char)
            // Remove the character from the list
            nameList.removeAt(index)
        } else {
            // Append the character to the list
            nameList.add(char)
        }
    }

    // Sort the list of characters in ascending order
    nameList.sort()

    // Join the characters in the list to form the modified name
    val modifiedName = nameList.joinToString("")

    return modifiedName
}