/**
 * This function takes two sets of materials in stock and returns the common materials available in both inventories.
 *
 * @param inventory1 Set of materials available in the first inventory.
 * @param inventory2 Set of materials available in the second inventory.
 * @return Set of common materials available in both inventories.
 */
fun findCommonMaterialsInStock(inventory1: Set<String>, inventory2: Set<String>): Set<String> {

    val commonMaterials = mutableSetOf<String>()

    // Loop through each material in inventory1
    for (material1 in inventory1) {
        // Loop through each material in inventory2
        for (material2 in inventory2) {
            // Check if the material in inventory1 is also present in inventory2
            if (material1 == material2) {
                // Add the common material to the set commonMaterials
                commonMaterials.add(material1)
                // Break out of the inner loop to avoid unnecessary comparisons
                break
            }
        }
    }

    return commonMaterials
}
/**
 * This function takes two sets of materials in stock and returns the common materials available in both inventories.
 *
 * @param inventory1 Set of materials available in the first inventory.
 * @param inventory2 Set of materials available in the second inventory.
 * @return Set of common materials available in both inventories.
 */
fun findCommonMaterialsInStock(inventory1: Set<String>, inventory2: Set<String>): Set<String> {
/**
 * This function takes two sets of materials in stock and returns the common materials available in both inventories.
 *
 * @param inventory1 Set of materials available in the first inventory.
 * @param inventory2 Set of materials available in the second inventory.
 * @return Set of common materials available in both inventories.
 */
fun findCommonMaterialsInStock(inventory1: Set<String>, inventory2: Set<String>): Set<String> {

    val commonMaterials = mutableSetOf<String>()

    // Loop through each material in inventory1
    for (material1 in inventory1) {
        // Loop through each material in inventory2
        for (material2 in inventory2) {
            // Check if the material in inventory1 is also present in inventory2
            if (material1 == material2) {
                // Add the common material to the set commonMaterials
                commonMaterials.add(material1)
                // Break out of the inner loop to avoid unnecessary comparisons
                break
            }
        }
    }

    return commonMaterials
}