/**
 * This exercise requires you to write a function that takes in two lists, t1 and t2,
 * and returns a new list containing only the elements that are common to both t1 and t2.
 *
 * @param t1 A list containing elements of any type.
 * @param t2 A list containing elements of any type.
 * @return A list containing the elements that are common to both t1 and t2.
 *
 * Example:
 * val t1 = listOf(1, 2, 3, 4, 5)
 * val t2 = listOf(4, 5, 6, 7, 8)
 * getCommonElements(t1, t2) will return listOf(4, 5).
 */
fun getCommonElements(t1: List<Any>, t2: List<Any>): List<Any> {

    val commonElements = mutableListOf<Any>()
    for (element in t1) {
        if (element in t2) {
            commonElements.add(element)
        }
    }
    return commonElements
}
/**
 * This exercise requires you to write a function that takes in two lists, t1 and t2,
 * and returns a new list containing only the elements that are common to both t1 and t2.
 *
 * @param t1 A list containing elements of any type.
 * @param t2 A list containing elements of any type.
 * @return A list containing the elements that are common to both t1 and t2.
 *
 * Example:
 * val t1 = listOf(1, 2, 3, 4, 5)
 * val t2 = listOf(4, 5, 6, 7, 8)
 * getCommonElements(t1, t2) will return listOf(4, 5).
 */
fun getCommonElements(t1: List<Any>, t2: List<Any>): List<Any> {
/**
 * This exercise requires you to write a function that takes in two lists, t1 and t2,
 * and returns a new list containing only the elements that are common to both t1 and t2.
 *
 * @param t1 A list containing elements of any type.
 * @param t2 A list containing elements of any type.
 * @return A list containing the elements that are common to both t1 and t2.
 *
 * Example:
 * val t1 = listOf(1, 2, 3, 4, 5)
 * val t2 = listOf(4, 5, 6, 7, 8)
 * getCommonElements(t1, t2) will return listOf(4, 5).
 */
fun getCommonElements(t1: List<Any>, t2: List<Any>): List<Any> {

    val commonElements = mutableListOf<Any>()
    for (element in t1) {
        if (element in t2) {
            commonElements.add(element)
        }
    }
    return commonElements
}