/**
 * Given two toolboxes belonging to two different carpenters, this function finds the common tools they have.
 *
 * @param toolbox1 The list of tools in the first carpenter's toolbox.
 * @param toolbox2 The list of tools in the second carpenter's toolbox.
 * @return A list of common tools between the two carpenters.
 */
fun findCommonTools(toolbox1: List<String>, toolbox2: List<String>): List<String> {

    val commonTools = mutableListOf<String>()

    var index1 = 0
    while (index1 < toolbox1.size) {
        val tool1 = toolbox1[index1]

        var index2 = 0
        while (index2 < toolbox2.size) {
            val tool2 = toolbox2[index2]

            if (tool1 == tool2) {
                commonTools.add(tool1)
                break
            }

            index2++
        }

        index1++
    }

    return commonTools
}
/**
 * Given two toolboxes belonging to two different carpenters, this function finds the common tools they have.
 *
 * @param toolbox1 The list of tools in the first carpenter's toolbox.
 * @param toolbox2 The list of tools in the second carpenter's toolbox.
 * @return A list of common tools between the two carpenters.
 */
fun findCommonTools(toolbox1: List<String>, toolbox2: List<String>): List<String> {
/**
 * Given two toolboxes belonging to two different carpenters, this function finds the common tools they have.
 *
 * @param toolbox1 The list of tools in the first carpenter's toolbox.
 * @param toolbox2 The list of tools in the second carpenter's toolbox.
 * @return A list of common tools between the two carpenters.
 */
fun findCommonTools(toolbox1: List<String>, toolbox2: List<String>): List<String> {

    val commonTools = mutableListOf<String>()

    var index1 = 0
    while (index1 < toolbox1.size) {
        val tool1 = toolbox1[index1]

        var index2 = 0
        while (index2 < toolbox2.size) {
            val tool2 = toolbox2[index2]

            if (tool1 == tool2) {
                commonTools.add(tool1)
                break
            }

            index2++
        }

        index1++
    }

    return commonTools
}