/**
 * Given two tuples, return a new tuple that contains the concatenation of the two input tuples.
 * If any element in tuple1 is found in tuple2, the element should be repeated twice in the resulting tuple.
 *
 * For example:
 * combineTuples(listOf('A', 'B', 'C'), listOf('B', 'C', 'D')) should return listOf('A', 'B', 'B', 'C', 'C', 'D')
 * combineTuples(listOf('X', 'Y', 'Z'), listOf('A', 'B', 'C')) should return listOf('X', 'Y', 'Z', 'A', 'B', 'C')
 *
 * @param tuple1 The first input tuple
 * @param tuple2 The second input tuple
 * @return The resulting tuple
 */
fun combineTuples(tuple1: List<Char>, tuple2: List<Char>): List<Char> {

    val result = mutableListOf<Char>()
    for (element in tuple1) {
        if (element in tuple2) {
            result.add(element)
            result.add(element)
        } else {
            result.add(element)
        }
    }
    return result
}
/**
 * Given two tuples, return a new tuple that contains the concatenation of the two input tuples.
 * If any element in tuple1 is found in tuple2, the element should be repeated twice in the resulting tuple.
 *
 * For example:
 * combineTuples(listOf('A', 'B', 'C'), listOf('B', 'C', 'D')) should return listOf('A', 'B', 'B', 'C', 'C', 'D')
 * combineTuples(listOf('X', 'Y', 'Z'), listOf('A', 'B', 'C')) should return listOf('X', 'Y', 'Z', 'A', 'B', 'C')
 *
 * @param tuple1 The first input tuple
 * @param tuple2 The second input tuple
 * @return The resulting tuple
 */
fun combineTuples(tuple1: List<Char>, tuple2: List<Char>): List<Char> {
/**
 * Given two tuples, return a new tuple that contains the concatenation of the two input tuples.
 * If any element in tuple1 is found in tuple2, the element should be repeated twice in the resulting tuple.
 *
 * For example:
 * combineTuples(listOf('A', 'B', 'C'), listOf('B', 'C', 'D')) should return listOf('A', 'B', 'B', 'C', 'C', 'D')
 * combineTuples(listOf('X', 'Y', 'Z'), listOf('A', 'B', 'C')) should return listOf('X', 'Y', 'Z', 'A', 'B', 'C')
 *
 * @param tuple1 The first input tuple
 * @param tuple2 The second input tuple
 * @return The resulting tuple
 */
fun combineTuples(tuple1: List<Char>, tuple2: List<Char>): List<Char> {

    val result = mutableListOf<Char>()
    for (element in tuple1) {
        if (element in tuple2) {
            result.add(element)
            result.add(element)
        } else {
            result.add(element)
        }
    }
    return result
}