/**
 * Given two albums represented as lists of songs, return a list of songs that appear in both albums.
 *
 * Example:
 * commonSongs(listOf("song1", "song2", "song3", "song4"), listOf("song2", "song4", "song6", "song8"))
 *
 * Expected Output:
 * ["song2", "song4"]
 */
fun commonSongs(album1: List<String>, album2: List<String>): List<String> {

    val common = mutableListOf<String>()
    // Iterate over each song in album1
    for (song1 in album1) {
        // Iterate over each song in album2
        for (song2 in album2) {
            // Check if the songs are the same
            if (song1 == song2) {
                // Add the song to the common list
                common.add(song1)
                // Stop iterating through songs in album2 as we found a match
                break
            }
        }
    }
    return common
}
/**
 * Given two albums represented as lists of songs, return a list of songs that appear in both albums.
 *
 * Example:
 * commonSongs(listOf("song1", "song2", "song3", "song4"), listOf("song2", "song4", "song6", "song8"))
 *
 * Expected Output:
 * ["song2", "song4"]
 */
fun commonSongs(album1: List<String>, album2: List<String>): List<String> {
/**
 * Given two albums represented as lists of songs, return a list of songs that appear in both albums.
 *
 * Example:
 * commonSongs(listOf("song1", "song2", "song3", "song4"), listOf("song2", "song4", "song6", "song8"))
 *
 * Expected Output:
 * ["song2", "song4"]
 */
fun commonSongs(album1: List<String>, album2: List<String>): List<String> {

    val common = mutableListOf<String>()
    // Iterate over each song in album1
    for (song1 in album1) {
        // Iterate over each song in album2
        for (song2 in album2) {
            // Check if the songs are the same
            if (song1 == song2) {
                // Add the song to the common list
                common.add(song1)
                // Stop iterating through songs in album2 as we found a match
                break
            }
        }
    }
    return common
}