/**
 * This exercise tests your ability to apply programming concepts to real-life scenarios as a musician.
 * Your task is to write a function that composes a song based on the given title and genre.
 * The function should return the composed song as a string of musical notes.
 */
fun composeSong(title: String, genre: String): String {

    // Create a dictionary mapping each genre to its corresponding musical notes
    val genreNotes = mapOf(
        "rock" to "C D E F G A B",
        "jazz" to "Cm Gm Fm Bb",
        "pop" to "C Dm Em F G Am Bdim",
        "blues" to "C7 F7 G7",
        "classical" to "C3 D3 E3 F3 G3 A3 B3"
    )

    // Check if the genre exists in the dictionary
    if (!genreNotes.containsKey(genre)) {
        return "Genre not supported!"
    }

    // Retrieve the musical notes for the given genre
    val notes = genreNotes.getValue(genre).split(" ")

    // Compose the song based on the title and musical notes
    var composedSong = ""
    title.split(" ").forEach { word ->
        val note = notes[word.length % notes.size]
        composedSong += note
    }

    return composedSong
}
/**
 * This exercise tests your ability to apply programming concepts to real-life scenarios as a musician.
 * Your task is to write a function that composes a song based on the given title and genre.
 * The function should return the composed song as a string of musical notes.
 */
fun composeSong(title: String, genre: String): String {
/**
 * This exercise tests your ability to apply programming concepts to real-life scenarios as a musician.
 * Your task is to write a function that composes a song based on the given title and genre.
 * The function should return the composed song as a string of musical notes.
 */
fun composeSong(title: String, genre: String): String {

    // Create a dictionary mapping each genre to its corresponding musical notes
    val genreNotes = mapOf(
        "rock" to "C D E F G A B",
        "jazz" to "Cm Gm Fm Bb",
        "pop" to "C Dm Em F G Am Bdim",
        "blues" to "C7 F7 G7",
        "classical" to "C3 D3 E3 F3 G3 A3 B3"
    )

    // Check if the genre exists in the dictionary
    if (!genreNotes.containsKey(genre)) {
        return "Genre not supported!"
    }

    // Retrieve the musical notes for the given genre
    val notes = genreNotes.getValue(genre).split(" ")

    // Compose the song based on the title and musical notes
    var composedSong = ""
    title.split(" ").forEach { word ->
        val note = notes[word.length % notes.size]
        composedSong += note
    }

    return composedSong
}