/**
 * Given a list of notes played by a musician and a section of the song, this function will
 * count the number of times the section is repeated within the song.
 *
 * @param notes A list of notes played by the musician
 * @param section A list representing a section of the song
 * @return The number of times the section is repeated within the song
 */
fun countNotesInSection(notes: List<Int>, section: List<Int>): Int {

    var count = 0
    val sectionLength = section.size
    val notesLength = notes.size

    for (i in 0 until notesLength - sectionLength + 1) {
        var sectionMatched = false

        if (notes[i] == section[0]) {
            sectionMatched = true

            for (j in 1 until sectionLength) {
                if (notes[i + j] != section[j]) {
                    sectionMatched = false
                    break
                }
            }
        }

        if (sectionMatched) {
            count++
        }
    }

    return count
}
/**
 * Given a list of notes played by a musician and a section of the song, this function will
 * count the number of times the section is repeated within the song.
 *
 * @param notes A list of notes played by the musician
 * @param section A list representing a section of the song
 * @return The number of times the section is repeated within the song
 */
fun countNotesInSection(notes: List<Int>, section: List<Int>): Int {
/**
 * Given a list of notes played by a musician and a section of the song, this function will
 * count the number of times the section is repeated within the song.
 *
 * @param notes A list of notes played by the musician
 * @param section A list representing a section of the song
 * @return The number of times the section is repeated within the song
 */
fun countNotesInSection(notes: List<Int>, section: List<Int>): Int {

    var count = 0
    val sectionLength = section.size
    val notesLength = notes.size

    for (i in 0 until notesLength - sectionLength + 1) {
        var sectionMatched = false

        if (notes[i] == section[0]) {
            sectionMatched = true

            for (j in 1 until sectionLength) {
                if (notes[i + j] != section[j]) {
                    sectionMatched = false
                    break
                }
            }
        }

        if (sectionMatched) {
            count++
        }
    }

    return count
}