/**
 * Given a list of photographs, this function removes all the photos with less than 2 subjects.
 * It uses the 'break' statement to exit the loop when a photo with 2 subjects or more is found.
 *
 * @param photos A list of photographs, where each photo is represented as a dictionary with the following keys:
 *               - 'name' (String): The name of the photograph.
 *               - 'subjects' (List<String>): A list of subjects present in the photograph.
 * @return A new list of photographs with all the photos containing less than 2 subjects removed.
 */
fun breakStatementAndEmptyLists(photos: List<Map<String, Any>>): List<Map<String, Any>> {

    val results = mutableListOf<Map<String, Any>>() // List to store photos with 2 or more subjects

    for (photo in photos) {
        if ((photo["subjects"] as List<*>).size < 2) {
            continue // Skip photos with less than 2 subjects
        }

        results.add(photo) // Add photos with 2 or more subjects to the results list

        // Break the loop if a photo with at least 2 subjects is found
        if ((photo["subjects"] as List<*>).size >= 2) {
            break
        }
    }

    return results
}
/**
 * Given a list of photographs, this function removes all the photos with less than 2 subjects.
 * It uses the 'break' statement to exit the loop when a photo with 2 subjects or more is found.
 *
 * @param photos A list of photographs, where each photo is represented as a dictionary with the following keys:
 *               - 'name' (String): The name of the photograph.
 *               - 'subjects' (List<String>): A list of subjects present in the photograph.
 * @return A new list of photographs with all the photos containing less than 2 subjects removed.
 */
fun breakStatementAndEmptyLists(photos: List<Map<String, Any>>): List<Map<String, Any>> {
/**
 * Given a list of photographs, this function removes all the photos with less than 2 subjects.
 * It uses the 'break' statement to exit the loop when a photo with 2 subjects or more is found.
 *
 * @param photos A list of photographs, where each photo is represented as a dictionary with the following keys:
 *               - 'name' (String): The name of the photograph.
 *               - 'subjects' (List<String>): A list of subjects present in the photograph.
 * @return A new list of photographs with all the photos containing less than 2 subjects removed.
 */
fun breakStatementAndEmptyLists(photos: List<Map<String, Any>>): List<Map<String, Any>> {

    val results = mutableListOf<Map<String, Any>>() // List to store photos with 2 or more subjects

    for (photo in photos) {
        if ((photo["subjects"] as List<*>).size < 2) {
            continue // Skip photos with less than 2 subjects
        }

        results.add(photo) // Add photos with 2 or more subjects to the results list

        // Break the loop if a photo with at least 2 subjects is found
        if ((photo["subjects"] as List<*>).size >= 2) {
            break
        }
    }

    return results
}