/**
 * Perform the specified set operation on two sets using a ternary operator.
 *
 * @param set1 The first set.
 * @param set2 The second set.
 * @param operation The set operation to perform. Accepts 'intersection', 'union', or 'difference'.
 * @return The result of the set operation.
 *
 * Example:
 * setOperation(setOf(1, 2, 3), setOf(2, 3, 4), "intersection") // returns setOf(2, 3)
 * setOperation(setOf(1, 2, 3), setOf(2, 3, 4), "union") // returns setOf(1, 2, 3, 4)
 * setOperation(setOf(1, 2, 3), setOf(2, 3, 4), "difference") // returns setOf(1)
 */
fun setOperation(set1: Set<Int>, set2: Set<Int>, operation: String): Set<Int> {

    return if (operation == "intersection") set1.intersect(set2)
    else if (operation == "union") set1.union(set2)
    else set1.minus(set2)
}
/**
 * Perform the specified set operation on two sets using a ternary operator.
 *
 * @param set1 The first set.
 * @param set2 The second set.
 * @param operation The set operation to perform. Accepts 'intersection', 'union', or 'difference'.
 * @return The result of the set operation.
 *
 * Example:
 * setOperation(setOf(1, 2, 3), setOf(2, 3, 4), "intersection") // returns setOf(2, 3)
 * setOperation(setOf(1, 2, 3), setOf(2, 3, 4), "union") // returns setOf(1, 2, 3, 4)
 * setOperation(setOf(1, 2, 3), setOf(2, 3, 4), "difference") // returns setOf(1)
 */
fun setOperation(set1: Set<Int>, set2: Set<Int>, operation: String): Set<Int> {
/**
 * Perform the specified set operation on two sets using a ternary operator.
 *
 * @param set1 The first set.
 * @param set2 The second set.
 * @param operation The set operation to perform. Accepts 'intersection', 'union', or 'difference'.
 * @return The result of the set operation.
 *
 * Example:
 * setOperation(setOf(1, 2, 3), setOf(2, 3, 4), "intersection") // returns setOf(2, 3)
 * setOperation(setOf(1, 2, 3), setOf(2, 3, 4), "union") // returns setOf(1, 2, 3, 4)
 * setOperation(setOf(1, 2, 3), setOf(2, 3, 4), "difference") // returns setOf(1)
 */
fun setOperation(set1: Set<Int>, set2: Set<Int>, operation: String): Set<Int> {

    return if (operation == "intersection") set1.intersect(set2)
    else if (operation == "union") set1.union(set2)
    else set1.minus(set2)
}