/**
 * This function takes in two tuples representing firefighters and returns the intersection of their names,
 * considering only the characters common to both names.
 *
 * @param firefighter1 A tuple representing the name of the first firefighter.
 * @param firefighter2 A tuple representing the name of the second firefighter.
 * @return A tuple containing the characters that are common to both firefighter names.
 *
 * Example:
 * intersectionTuplesForLoop(listOf('J', 'o', 'h', 'n'), listOf('J', 'a', 'c', 'k'))
 * Output: listOf('J')
 */
fun intersectionTuplesForLoop(firefighter1: List<Char>, firefighter2: List<Char>): List<Char> {

    val intersection = mutableListOf<Char>()

    // Loop through the characters in the first firefighter's name
    for (char in firefighter1) {
        // Check if the character exists in the second firefighter's name
        if (char in firefighter2) {
            // Add the character to the intersection list
            intersection.add(char)
        }
    }

    return intersection
}
/**
 * This function takes in two tuples representing firefighters and returns the intersection of their names,
 * considering only the characters common to both names.
 *
 * @param firefighter1 A tuple representing the name of the first firefighter.
 * @param firefighter2 A tuple representing the name of the second firefighter.
 * @return A tuple containing the characters that are common to both firefighter names.
 *
 * Example:
 * intersectionTuplesForLoop(listOf('J', 'o', 'h', 'n'), listOf('J', 'a', 'c', 'k'))
 * Output: listOf('J')
 */
fun intersectionTuplesForLoop(firefighter1: List<Char>, firefighter2: List<Char>): List<Char> {
/**
 * This function takes in two tuples representing firefighters and returns the intersection of their names,
 * considering only the characters common to both names.
 *
 * @param firefighter1 A tuple representing the name of the first firefighter.
 * @param firefighter2 A tuple representing the name of the second firefighter.
 * @return A tuple containing the characters that are common to both firefighter names.
 *
 * Example:
 * intersectionTuplesForLoop(listOf('J', 'o', 'h', 'n'), listOf('J', 'a', 'c', 'k'))
 * Output: listOf('J')
 */
fun intersectionTuplesForLoop(firefighter1: List<Char>, firefighter2: List<Char>): List<Char> {

    val intersection = mutableListOf<Char>()

    // Loop through the characters in the first firefighter's name
    for (char in firefighter1) {
        // Check if the character exists in the second firefighter's name
        if (char in firefighter2) {
            // Add the character to the intersection list
            intersection.add(char)
        }
    }

    return intersection
}