/**
 * Given a sequence of musical notes, find the number of consecutive intervals of at least 3 consecutive notes.
 * Return the count of such intervals.
 */
fun findConsecutiveIntervals(notes: String): Pair<Int, List<String>> {

    var countIntervals = 0
    val consecutiveNotes = mutableListOf<String>()
    
    for (i in 0 until notes.length - 2) {
        if (Math.abs(notes[i].toInt() - notes[i + 1].toInt()) == 1 && Math.abs(notes[i + 1].toInt() - notes[i + 2].toInt()) == 1) {
            consecutiveNotes.add(notes[i].toString())
            consecutiveNotes.add(notes[i + 1].toString())
            consecutiveNotes.add(notes[i + 2].toString())
            countIntervals++
        }
    }
    
    return Pair(countIntervals, consecutiveNotes)
}
/**
 * Given a sequence of musical notes, find the number of consecutive intervals of at least 3 consecutive notes.
 * Return the count of such intervals.
 */
fun findConsecutiveIntervals(notes: String): Pair<Int, List<String>> {
/**
 * Given a sequence of musical notes, find the number of consecutive intervals of at least 3 consecutive notes.
 * Return the count of such intervals.
 */
fun findConsecutiveIntervals(notes: String): Pair<Int, List<String>> {

    var countIntervals = 0
    val consecutiveNotes = mutableListOf<String>()
    
    for (i in 0 until notes.length - 2) {
        if (Math.abs(notes[i].toInt() - notes[i + 1].toInt()) == 1 && Math.abs(notes[i + 1].toInt() - notes[i + 2].toInt()) == 1) {
            consecutiveNotes.add(notes[i].toString())
            consecutiveNotes.add(notes[i + 1].toString())
            consecutiveNotes.add(notes[i + 2].toString())
            countIntervals++
        }
    }
    
    return Pair(countIntervals, consecutiveNotes)
}