/**
 * This function takes a list of strings and a list of indices, 
 * and concatenates the selected strings based on the given indices.
 *
 * @param strings A list of strings.
 * @param indices A list of indices indicating which strings to concatenate.
 * @return The concatenated string.
 *
 * Example:
 * concatenateSelected(listOf("a", "b", "c", "d"), listOf(0, 2)) -> "ac"
 * concatenateSelected(listOf("hello", "world", "!", "python"), listOf(1, 3, 0, 2)) -> "worldpythonhello!"
 */
fun concatenateSelected(strings: List<String>, indices: List<Int>): String {

    val selectedStrings = indices.map { strings[it] }
    return selectedStrings.joinToString("")
}
/**
 * This function takes a list of strings and a list of indices, 
 * and concatenates the selected strings based on the given indices.
 *
 * @param strings A list of strings.
 * @param indices A list of indices indicating which strings to concatenate.
 * @return The concatenated string.
 *
 * Example:
 * concatenateSelected(listOf("a", "b", "c", "d"), listOf(0, 2)) -> "ac"
 * concatenateSelected(listOf("hello", "world", "!", "python"), listOf(1, 3, 0, 2)) -> "worldpythonhello!"
 */
fun concatenateSelected(strings: List<String>, indices: List<Int>): String {
/**
 * This function takes a list of strings and a list of indices, 
 * and concatenates the selected strings based on the given indices.
 *
 * @param strings A list of strings.
 * @param indices A list of indices indicating which strings to concatenate.
 * @return The concatenated string.
 *
 * Example:
 * concatenateSelected(listOf("a", "b", "c", "d"), listOf(0, 2)) -> "ac"
 * concatenateSelected(listOf("hello", "world", "!", "python"), listOf(1, 3, 0, 2)) -> "worldpythonhello!"
 */
fun concatenateSelected(strings: List<String>, indices: List<Int>): String {

    val selectedStrings = indices.map { strings[it] }
    return selectedStrings.joinToString("")
}