/**
 * This function takes a list of photos as input and counts the occurrences of a specific element.
 * It then slices the list from start_index to end_index and replaces the sliced part with a new element.
 *
 * @param photoList A list of photos.
 * @param startIndex The starting index of the slice.
 * @param endIndex The ending index of the slice.
 * @param replacement The element to replace the sliced part with.
 * @return Pair<Int, List<String>> The count of the occurrence of a specific element and the updated list after replacing the sliced part with the replacement element.
 */
fun countAndSlice(photoList: List<String>, startIndex: Int, endIndex: Int, replacement: String): Pair<Int, List<String>> {

    var count = 0

    for (photo in photoList) {
        if (photo == "example_element") {
            count++
        }
    }

    val slicedPart = photoList.subList(startIndex, endIndex)
    val newList = photoList.subList(0, startIndex) + listOf(replacement) + photoList.subList(endIndex, photoList.size)

    return Pair(count, newList)
}
/**
 * This function takes a list of photos as input and counts the occurrences of a specific element.
 * It then slices the list from start_index to end_index and replaces the sliced part with a new element.
 *
 * @param photoList A list of photos.
 * @param startIndex The starting index of the slice.
 * @param endIndex The ending index of the slice.
 * @param replacement The element to replace the sliced part with.
 * @return Pair<Int, List<String>> The count of the occurrence of a specific element and the updated list after replacing the sliced part with the replacement element.
 */
fun countAndSlice(photoList: List<String>, startIndex: Int, endIndex: Int, replacement: String): Pair<Int, List<String>> {
/**
 * This function takes a list of photos as input and counts the occurrences of a specific element.
 * It then slices the list from start_index to end_index and replaces the sliced part with a new element.
 *
 * @param photoList A list of photos.
 * @param startIndex The starting index of the slice.
 * @param endIndex The ending index of the slice.
 * @param replacement The element to replace the sliced part with.
 * @return Pair<Int, List<String>> The count of the occurrence of a specific element and the updated list after replacing the sliced part with the replacement element.
 */
fun countAndSlice(photoList: List<String>, startIndex: Int, endIndex: Int, replacement: String): Pair<Int, List<String>> {

    var count = 0

    for (photo in photoList) {
        if (photo == "example_element") {
            count++
        }
    }

    val slicedPart = photoList.subList(startIndex, endIndex)
    val newList = photoList.subList(0, startIndex) + listOf(replacement) + photoList.subList(endIndex, photoList.size)

    return Pair(count, newList)
}