/**
 * This function takes a data structure and converts it into a set.
 *
 * @param data The data structure to be converted. Can be a list, tuple, or string.
 * @return The converted set.
 * @throws IllegalArgumentException If the data structure is not of type list, tuple, or string.
 *
 * Examples:
 * convertToSet(listOf(1, 2, 3)) -> setOf(1, 2, 3)
 * convertToSet(setOf(1, 2, 3)) -> setOf(1, 2, 3)
 * convertToSet("abc") -> setOf('a', 'b', 'c')
 * convertToSet(123) -> IllegalArgumentException
 */
fun convertToSet(data: Any): Set<*> {

    return when (data) {
        is List<*> -> data.toSet()
        is Set<*> -> data
        is String -> data.toSet()
        else -> throw IllegalArgumentException("Data structure must be of type list, set, or string.")
    }
}
/**
 * This function takes a data structure and converts it into a set.
 *
 * @param data The data structure to be converted. Can be a list, tuple, or string.
 * @return The converted set.
 * @throws IllegalArgumentException If the data structure is not of type list, tuple, or string.
 *
 * Examples:
 * convertToSet(listOf(1, 2, 3)) -> setOf(1, 2, 3)
 * convertToSet(setOf(1, 2, 3)) -> setOf(1, 2, 3)
 * convertToSet("abc") -> setOf('a', 'b', 'c')
 * convertToSet(123) -> IllegalArgumentException
 */
fun convertToSet(data: Any): Set<*> {
/**
 * This function takes a data structure and converts it into a set.
 *
 * @param data The data structure to be converted. Can be a list, tuple, or string.
 * @return The converted set.
 * @throws IllegalArgumentException If the data structure is not of type list, tuple, or string.
 *
 * Examples:
 * convertToSet(listOf(1, 2, 3)) -> setOf(1, 2, 3)
 * convertToSet(setOf(1, 2, 3)) -> setOf(1, 2, 3)
 * convertToSet("abc") -> setOf('a', 'b', 'c')
 * convertToSet(123) -> IllegalArgumentException
 */
fun convertToSet(data: Any): Set<*> {

    return when (data) {
        is List<*> -> data.toSet()
        is Set<*> -> data
        is String -> data.toSet()
        else -> throw IllegalArgumentException("Data structure must be of type list, set, or string.")
    }
}