/**
 * Given a set of elements and a list of values, concatenate each element in the set
 * with each value in the list and add the resulting strings to a new set.
 *
 * @param elements Set of elements.
 * @param values List of values.
 * @return Set containing the concatenated strings.
 * @throws IllegalArgumentException If any of the input arguments are not of the expected type.
 *
 * Example:
 * '``
 * val elements = setOf("A", "B", "C")
 * val values = listOf("X", "Y")
 * concatenateElementsAndAddToSet(elements, values) // Output: setOf("AX", "AY", "BX", "BY", "CX", "CY")
 * '``
 */
fun concatenateElementsAndAddToSet(elements: Set<String>, values: List<String>): Set<String> {

    if (elements !is Set<*> || values !is List<*>) {
        throw IllegalArgumentException("Expected 'elements' to be a set and 'values' to be a list.")
    }

    val concatenatedSet = mutableSetOf<String>()
    for (element in elements) {
        for (value in values) {
            concatenatedSet.add(element + value)
        }
    }

    return concatenatedSet
}
/**
 * Given a set of elements and a list of values, concatenate each element in the set
 * with each value in the list and add the resulting strings to a new set.
 *
 * @param elements Set of elements.
 * @param values List of values.
 * @return Set containing the concatenated strings.
 * @throws IllegalArgumentException If any of the input arguments are not of the expected type.
 *
 * Example:
 * '``
 * val elements = setOf("A", "B", "C")
 * val values = listOf("X", "Y")
 * concatenateElementsAndAddToSet(elements, values) // Output: setOf("AX", "AY", "BX", "BY", "CX", "CY")
 * '``
 */
fun concatenateElementsAndAddToSet(elements: Set<String>, values: List<String>): Set<String> {
/**
 * Given a set of elements and a list of values, concatenate each element in the set
 * with each value in the list and add the resulting strings to a new set.
 *
 * @param elements Set of elements.
 * @param values List of values.
 * @return Set containing the concatenated strings.
 * @throws IllegalArgumentException If any of the input arguments are not of the expected type.
 *
 * Example:
 * '``
 * val elements = setOf("A", "B", "C")
 * val values = listOf("X", "Y")
 * concatenateElementsAndAddToSet(elements, values) // Output: setOf("AX", "AY", "BX", "BY", "CX", "CY")
 * '``
 */
fun concatenateElementsAndAddToSet(elements: Set<String>, values: List<String>): Set<String> {

    if (elements !is Set<*> || values !is List<*>) {
        throw IllegalArgumentException("Expected 'elements' to be a set and 'values' to be a list.")
    }

    val concatenatedSet = mutableSetOf<String>()
    for (element in elements) {
        for (value in values) {
            concatenatedSet.add(element + value)
        }
    }

    return concatenatedSet
}