/**
 * This function takes a playlist, an action, and a song as arguments and performs the specified action on the playlist.
 * The action can be 'add', 'remove', or 'shuffle'.
 *
 * @param playlist A list representing the current playlist.
 * @param action The action to be performed on the playlist.
 * @param song The name of the song to be added or removed from the playlist.
 * @return The updated playlist after performing the specified action.
 */
fun managePlaylist(playlist: MutableList<String>, action: String, song: String): MutableList<String> {

    when (action) {
        "add" -> {
            if (song !in playlist) {
                playlist.add(song)
            } else {
                println("The song '$song' is already in the playlist.")
            }
        }
        "remove" -> {
            if (song in playlist) {
                playlist.remove(song)
            } else {
                println("The song '$song' is not in the playlist.")
            }
        }
        "shuffle" -> {
            playlist.shuffle()
            println("Playlist shuffled successfully.")
        }
        else -> {
            println("Invalid action specified. Available actions are 'add', 'remove', or 'shuffle'.")
        }
    }

    return playlist
}
/**
 * This function takes a playlist, an action, and a song as arguments and performs the specified action on the playlist.
 * The action can be 'add', 'remove', or 'shuffle'.
 *
 * @param playlist A list representing the current playlist.
 * @param action The action to be performed on the playlist.
 * @param song The name of the song to be added or removed from the playlist.
 * @return The updated playlist after performing the specified action.
 */
fun managePlaylist(playlist: MutableList<String>, action: String, song: String): MutableList<String> {
/**
 * This function takes a playlist, an action, and a song as arguments and performs the specified action on the playlist.
 * The action can be 'add', 'remove', or 'shuffle'.
 *
 * @param playlist A list representing the current playlist.
 * @param action The action to be performed on the playlist.
 * @param song The name of the song to be added or removed from the playlist.
 * @return The updated playlist after performing the specified action.
 */
fun managePlaylist(playlist: MutableList<String>, action: String, song: String): MutableList<String> {

    when (action) {
        "add" -> {
            if (song !in playlist) {
                playlist.add(song)
            } else {
                println("The song '$song' is already in the playlist.")
            }
        }
        "remove" -> {
            if (song in playlist) {
                playlist.remove(song)
            } else {
                println("The song '$song' is not in the playlist.")
            }
        }
        "shuffle" -> {
            playlist.shuffle()
            println("Playlist shuffled successfully.")
        }
        else -> {
            println("Invalid action specified. Available actions are 'add', 'remove', or 'shuffle'.")
        }
    }

    return playlist
}