/**
 * Given a list of songs and a break sequence, find the song in the list where the break sequence occurs and
 * break out of the loop. Return the index of the song where the break sequence occurs. If the break sequence
 * is not found, return -1.
 *
 * @param songList List of songs.
 * @param breakSequence Sequence of notes indicating a break in a song.
 * @return Index of the song where the break sequence occurs. -1 if break sequence is not found.
 */
fun breakOutOfLoop(songList: List<String>, breakSequence: List<String>): Int {

    for (i in songList.indices) {
        val song = songList[i]
        for (j in 0 until song.length - breakSequence.size + 1) {
            if (song.substring(j, j + breakSequence.size) == breakSequence.joinToString("")) {
                return i
            }
        }
    }
    return -1
}
/**
 * Given a list of songs and a break sequence, find the song in the list where the break sequence occurs and
 * break out of the loop. Return the index of the song where the break sequence occurs. If the break sequence
 * is not found, return -1.
 *
 * @param songList List of songs.
 * @param breakSequence Sequence of notes indicating a break in a song.
 * @return Index of the song where the break sequence occurs. -1 if break sequence is not found.
 */
fun breakOutOfLoop(songList: List<String>, breakSequence: List<String>): Int {
/**
 * Given a list of songs and a break sequence, find the song in the list where the break sequence occurs and
 * break out of the loop. Return the index of the song where the break sequence occurs. If the break sequence
 * is not found, return -1.
 *
 * @param songList List of songs.
 * @param breakSequence Sequence of notes indicating a break in a song.
 * @return Index of the song where the break sequence occurs. -1 if break sequence is not found.
 */
fun breakOutOfLoop(songList: List<String>, breakSequence: List<String>): Int {

    for (i in songList.indices) {
        val song = songList[i]
        for (j in 0 until song.length - breakSequence.size + 1) {
            if (song.substring(j, j + breakSequence.size) == breakSequence.joinToString("")) {
                return i
            }
        }
    }
    return -1
}