/**
 * Given two lists of colors, find the intersection of colors using the count() method.
 *
 * @param colors1 The first list of colors.
 * @param colors2 The second list of colors.
 * @return The common colors found in both lists.
 *
 * Example:
 * colors1 = listOf("red", "green", "blue", "yellow", "orange")
 * colors2 = listOf("red", "green", "purple", "pink", "orange")
 * countIntersectionOfColors(colors1, colors2) // Output: ["red", "green", "orange"]
 */
fun countIntersectionOfColors(colors1: List<String>, colors2: List<String>): List<String> {

    val intersection = mutableListOf<String>()

    for (color in colors1) {
        if (color in colors2 && intersection.count { it == color } == 0) {
            intersection.add(color)
        }
    }

    return intersection
}
/**
 * Given two lists of colors, find the intersection of colors using the count() method.
 *
 * @param colors1 The first list of colors.
 * @param colors2 The second list of colors.
 * @return The common colors found in both lists.
 *
 * Example:
 * colors1 = listOf("red", "green", "blue", "yellow", "orange")
 * colors2 = listOf("red", "green", "purple", "pink", "orange")
 * countIntersectionOfColors(colors1, colors2) // Output: ["red", "green", "orange"]
 */
fun countIntersectionOfColors(colors1: List<String>, colors2: List<String>): List<String> {
/**
 * Given two lists of colors, find the intersection of colors using the count() method.
 *
 * @param colors1 The first list of colors.
 * @param colors2 The second list of colors.
 * @return The common colors found in both lists.
 *
 * Example:
 * colors1 = listOf("red", "green", "blue", "yellow", "orange")
 * colors2 = listOf("red", "green", "purple", "pink", "orange")
 * countIntersectionOfColors(colors1, colors2) // Output: ["red", "green", "orange"]
 */
fun countIntersectionOfColors(colors1: List<String>, colors2: List<String>): List<String> {

    val intersection = mutableListOf<String>()

    for (color in colors1) {
        if (color in colors2 && intersection.count { it == color } == 0) {
            intersection.add(color)
        }
    }

    return intersection
}