/**
 * Given a list of names and a map of replacements, replace the specified elements in the list using slicing.
 * If a replacement is not found, skip to the next iteration using 'continue'.
 *
 * @param names The list of names.
 * @param replacements The map mapping names to their replacement values.
 * @return The modified list of names with replacements.
 */
fun sliceAndReplaceElements(names: MutableList<String>, replacements: Map<String, String>): List<String> {

    for (i in names.indices) {
        val name = names[i]
        if (name in replacements) {
            names[i] = replacements[name]!!
            continue
        }
    }
    return names
}
/**
 * Given a list of names and a map of replacements, replace the specified elements in the list using slicing.
 * If a replacement is not found, skip to the next iteration using 'continue'.
 *
 * @param names The list of names.
 * @param replacements The map mapping names to their replacement values.
 * @return The modified list of names with replacements.
 */
fun sliceAndReplaceElements(names: MutableList<String>, replacements: Map<String, String>): List<String> {
/**
 * Given a list of names and a map of replacements, replace the specified elements in the list using slicing.
 * If a replacement is not found, skip to the next iteration using 'continue'.
 *
 * @param names The list of names.
 * @param replacements The map mapping names to their replacement values.
 * @return The modified list of names with replacements.
 */
fun sliceAndReplaceElements(names: MutableList<String>, replacements: Map<String, String>): List<String> {

    for (i in names.indices) {
        val name = names[i]
        if (name in replacements) {
            names[i] = replacements[name]!!
            continue
        }
    }
    return names
}