/**
 * The function takes in two carpenters' tool sets as lists and returns a list of common tool names.
 *
 * @param carpenter1 A list representing the tools of the first carpenter.
 * @param carpenter2 A list representing the tools of the second carpenter.
 * @return A list of common tool names between the two carpenters' tool sets.
 */
fun findCommonToolNames(carpenter1: List<Pair<String, String>>, carpenter2: List<Pair<String, String>>): List<String> {

    val commonTools = mutableListOf<String>()

    for (tool1 in carpenter1) {
        for (tool2 in carpenter2) {
            if (tool1.first == tool2.first) {  // Comparing the first element of the tool pairs
                commonTools.add(tool1.second)  // Accessing the second element of the tool pair
            }
        }
    }

    return commonTools
}
/**
 * The function takes in two carpenters' tool sets as lists and returns a list of common tool names.
 *
 * @param carpenter1 A list representing the tools of the first carpenter.
 * @param carpenter2 A list representing the tools of the second carpenter.
 * @return A list of common tool names between the two carpenters' tool sets.
 */
fun findCommonToolNames(carpenter1: List<Pair<String, String>>, carpenter2: List<Pair<String, String>>): List<String> {
/**
 * The function takes in two carpenters' tool sets as lists and returns a list of common tool names.
 *
 * @param carpenter1 A list representing the tools of the first carpenter.
 * @param carpenter2 A list representing the tools of the second carpenter.
 * @return A list of common tool names between the two carpenters' tool sets.
 */
fun findCommonToolNames(carpenter1: List<Pair<String, String>>, carpenter2: List<Pair<String, String>>): List<String> {

    val commonTools = mutableListOf<String>()

    for (tool1 in carpenter1) {
        for (tool2 in carpenter2) {
            if (tool1.first == tool2.first) {  // Comparing the first element of the tool pairs
                commonTools.add(tool1.second)  // Accessing the second element of the tool pair
            }
        }
    }

    return commonTools
}