/**
 * Given a list of moon phases, find the index of the first 'Full Moon' and 'New Moon'.
 *
 * @param moonData A list of moon phases.
 * @return A Pair containing the index of the first 'Full Moon' and 'New Moon' in the given list.
 * If no 'Full Moon' or 'New Moon' is found, return Pair(-1, -1).
 */
fun findMoonPhases(moonData: List<String>): Pair<Int, Int> {

    var fullMoonIndex = -1
    var newMoonIndex = -1

    // Iterate through the moonData list using list indices
    for (i in moonData.indices) {
        if (moonData[i] == "Full Moon" && fullMoonIndex == -1) {
            fullMoonIndex = i
        }

        if (moonData[i] == "New Moon" && newMoonIndex == -1) {
            newMoonIndex = i
        }

        // Short-circuit the loop if both 'Full Moon' and 'New Moon' have been found
        if (fullMoonIndex != -1 && newMoonIndex != -1) {
            break
        }
    }

    return Pair(fullMoonIndex, newMoonIndex)
}
/**
 * Given a list of moon phases, find the index of the first 'Full Moon' and 'New Moon'.
 *
 * @param moonData A list of moon phases.
 * @return A Pair containing the index of the first 'Full Moon' and 'New Moon' in the given list.
 * If no 'Full Moon' or 'New Moon' is found, return Pair(-1, -1).
 */
fun findMoonPhases(moonData: List<String>): Pair<Int, Int> {
/**
 * Given a list of moon phases, find the index of the first 'Full Moon' and 'New Moon'.
 *
 * @param moonData A list of moon phases.
 * @return A Pair containing the index of the first 'Full Moon' and 'New Moon' in the given list.
 * If no 'Full Moon' or 'New Moon' is found, return Pair(-1, -1).
 */
fun findMoonPhases(moonData: List<String>): Pair<Int, Int> {

    var fullMoonIndex = -1
    var newMoonIndex = -1

    // Iterate through the moonData list using list indices
    for (i in moonData.indices) {
        if (moonData[i] == "Full Moon" && fullMoonIndex == -1) {
            fullMoonIndex = i
        }

        if (moonData[i] == "New Moon" && newMoonIndex == -1) {
            newMoonIndex = i
        }

        // Short-circuit the loop if both 'Full Moon' and 'New Moon' have been found
        if (fullMoonIndex != -1 && newMoonIndex != -1) {
            break
        }
    }

    return Pair(fullMoonIndex, newMoonIndex)
}