/**
 * Takes two strings as input and returns a set containing common characters
 * between the two strings with duplicate characters removed and sorted in
 * ascending order.
 *
 * Example:
 * commonCharacters("hello", "world") -> setOf('o')
 *
 * Note:
 * - The function is case-sensitive, so 'H' and 'h' are considered different characters.
 * - Spaces and punctuation marks should be ignored.
 * - The strings can contain uppercase and lowercase letters, numbers, spaces, and punctuation marks.
 */
fun commonCharacters(string1: String, string2: String): Set<Char> {

    val set1 = string1.filter { it.isLetter() }.toSet()
    val set2 = string2.filter { it.isLetter() }.toSet()
    
    return set1.intersect(set2).toSortedSet()
}
/**
 * Takes two strings as input and returns a set containing common characters
 * between the two strings with duplicate characters removed and sorted in
 * ascending order.
 *
 * Example:
 * commonCharacters("hello", "world") -> setOf('o')
 *
 * Note:
 * - The function is case-sensitive, so 'H' and 'h' are considered different characters.
 * - Spaces and punctuation marks should be ignored.
 * - The strings can contain uppercase and lowercase letters, numbers, spaces, and punctuation marks.
 */
fun commonCharacters(string1: String, string2: String): Set<Char> {
/**
 * Takes two strings as input and returns a set containing common characters
 * between the two strings with duplicate characters removed and sorted in
 * ascending order.
 *
 * Example:
 * commonCharacters("hello", "world") -> setOf('o')
 *
 * Note:
 * - The function is case-sensitive, so 'H' and 'h' are considered different characters.
 * - Spaces and punctuation marks should be ignored.
 * - The strings can contain uppercase and lowercase letters, numbers, spaces, and punctuation marks.
 */
fun commonCharacters(string1: String, string2: String): Set<Char> {

    val set1 = string1.filter { it.isLetter() }.toSet()
    val set2 = string2.filter { it.isLetter() }.toSet()
    
    return set1.intersect(set2).toSortedSet()
}