/**
 * Write a function that appends the elements from list 1 to list 2 only if they are equal.
 *
 * @param inputList1 The first list.
 * @param inputList2 The second list.
 * @return The modified second list containing the appended elements from list 1.
 *
 * Example:
 * appendEqualElements(listOf(1, 2, 3), listOf(3, 4, 5)) returns [3, 4, 5, 1, 3]
 * appendEqualElements(listOf("a", "b", "c"), listOf("d", "e", "f")) returns ["d", "e", "f", "c"]
 */
fun appendEqualElements(inputList1: List<Any>, inputList2: MutableList<Any>): List<Any> {

    for (item in inputList1) {
        if (item in inputList2) {
            inputList2.add(item)
        }
    }
    return inputList2
}
/**
 * Write a function that appends the elements from list 1 to list 2 only if they are equal.
 *
 * @param inputList1 The first list.
 * @param inputList2 The second list.
 * @return The modified second list containing the appended elements from list 1.
 *
 * Example:
 * appendEqualElements(listOf(1, 2, 3), listOf(3, 4, 5)) returns [3, 4, 5, 1, 3]
 * appendEqualElements(listOf("a", "b", "c"), listOf("d", "e", "f")) returns ["d", "e", "f", "c"]
 */
fun appendEqualElements(inputList1: List<Any>, inputList2: MutableList<Any>): List<Any> {
/**
 * Write a function that appends the elements from list 1 to list 2 only if they are equal.
 *
 * @param inputList1 The first list.
 * @param inputList2 The second list.
 * @return The modified second list containing the appended elements from list 1.
 *
 * Example:
 * appendEqualElements(listOf(1, 2, 3), listOf(3, 4, 5)) returns [3, 4, 5, 1, 3]
 * appendEqualElements(listOf("a", "b", "c"), listOf("d", "e", "f")) returns ["d", "e", "f", "c"]
 */
fun appendEqualElements(inputList1: List<Any>, inputList2: MutableList<Any>): List<Any> {

    for (item in inputList1) {
        if (item in inputList2) {
            inputList2.add(item)
        }
    }
    return inputList2
}