/**
 * Given a list of elements, append the new elements to the list.
 * However, if an element in the new elements starts with the letter 'S', skip appending that element and continue to the next element.
 *
 * @param elements a list of elements (strings)
 * @param newElements a list of new elements to be appended (strings)
 * @return finalElements a list of elements after appending the new elements
 *
 * Example:
 * appendContinue(listOf("apple", "banana", "cherry"), listOf("strawberry", "kiwi", "mango"))
 * Output: ["apple", "banana", "cherry", "kiwi", "mango"]
 */
fun appendContinue(elements: List<String>, newElements: List<String>): List<String> {

    val finalElements = elements.toMutableList()  // Create a copy of elements to avoid modifying the original list

    for (element in newElements) {
        if (element.startsWith("S")) {  // Check if the element starts with 'S'
            continue  // Skip to the next iteration if it does
        }
        finalElements.add(element)  // Append the element to the final list
    }

    return finalElements
}
/**
 * Given a list of elements, append the new elements to the list.
 * However, if an element in the new elements starts with the letter 'S', skip appending that element and continue to the next element.
 *
 * @param elements a list of elements (strings)
 * @param newElements a list of new elements to be appended (strings)
 * @return finalElements a list of elements after appending the new elements
 *
 * Example:
 * appendContinue(listOf("apple", "banana", "cherry"), listOf("strawberry", "kiwi", "mango"))
 * Output: ["apple", "banana", "cherry", "kiwi", "mango"]
 */
fun appendContinue(elements: List<String>, newElements: List<String>): List<String> {
/**
 * Given a list of elements, append the new elements to the list.
 * However, if an element in the new elements starts with the letter 'S', skip appending that element and continue to the next element.
 *
 * @param elements a list of elements (strings)
 * @param newElements a list of new elements to be appended (strings)
 * @return finalElements a list of elements after appending the new elements
 *
 * Example:
 * appendContinue(listOf("apple", "banana", "cherry"), listOf("strawberry", "kiwi", "mango"))
 * Output: ["apple", "banana", "cherry", "kiwi", "mango"]
 */
fun appendContinue(elements: List<String>, newElements: List<String>): List<String> {

    val finalElements = elements.toMutableList()  // Create a copy of elements to avoid modifying the original list

    for (element in newElements) {
        if (element.startsWith("S")) {  // Check if the element starts with 'S'
            continue  // Skip to the next iteration if it does
        }
        finalElements.add(element)  // Append the element to the final list
    }

    return finalElements
}