/**
 * Given a word and a list of strings, find the position of the word in the list
 * and return the concatenated string from the word's position until the end of the list.
 *
 * @param word The word to search for in the list.
 * @param list The list of strings.
 * @return The concatenated string from the word's position until the end of the list.
 *
 * Examples:
 * findWordInList("archaeology", listOf("prehistoric", "archaeology", "artifacts")) // Output: archaeologyartifacts
 * findWordInList("excavation", listOf("prehistoric", "archaeology", "artifacts")) // Output: ""
 * findWordInList("prehistoric", listOf("prehistoric", "archaeology", "artifacts")) // Output: prehistoricarchaeologyartifacts
 */
fun findWordInList(word: String, list: List<String>): String {

    val positions = list.mapIndexedNotNull { index, value -> if (value == word) index else null }
    if (positions.isEmpty()) {
        return ""
    } else {
        val startIndex = positions[0]
        return list.subList(startIndex, list.size).joinToString("")
    }
}
/**
 * Given a word and a list of strings, find the position of the word in the list
 * and return the concatenated string from the word's position until the end of the list.
 *
 * @param word The word to search for in the list.
 * @param list The list of strings.
 * @return The concatenated string from the word's position until the end of the list.
 *
 * Examples:
 * findWordInList("archaeology", listOf("prehistoric", "archaeology", "artifacts")) // Output: archaeologyartifacts
 * findWordInList("excavation", listOf("prehistoric", "archaeology", "artifacts")) // Output: ""
 * findWordInList("prehistoric", listOf("prehistoric", "archaeology", "artifacts")) // Output: prehistoricarchaeologyartifacts
 */
fun findWordInList(word: String, list: List<String>): String {
/**
 * Given a word and a list of strings, find the position of the word in the list
 * and return the concatenated string from the word's position until the end of the list.
 *
 * @param word The word to search for in the list.
 * @param list The list of strings.
 * @return The concatenated string from the word's position until the end of the list.
 *
 * Examples:
 * findWordInList("archaeology", listOf("prehistoric", "archaeology", "artifacts")) // Output: archaeologyartifacts
 * findWordInList("excavation", listOf("prehistoric", "archaeology", "artifacts")) // Output: ""
 * findWordInList("prehistoric", listOf("prehistoric", "archaeology", "artifacts")) // Output: prehistoricarchaeologyartifacts
 */
fun findWordInList(word: String, list: List<String>): String {

    val positions = list.mapIndexedNotNull { index, value -> if (value == word) index else null }
    if (positions.isEmpty()) {
        return ""
    } else {
        val startIndex = positions[0]
        return list.subList(startIndex, list.size).joinToString("")
    }
}