/**
 * Given two names, find the common letters between them.
 * For example, if name1 = "Johnny Depp" and name2 = "Penelope Cruz",
 * the common letters are 'e', 'o', and 'p'.
 *
 * @param name1 a string representing the first name.
 * @param name2 a string representing the second name.
 * @return a set containing the common letters between name1 and name2.
 */
fun commonLetters(name1: String, name2: String): Set<Char> {

    // Convert the names to lowercase to make the comparison case-insensitive
    val name1Lower = name1.toLowerCase()
    val name2Lower = name2.toLowerCase()

    // Initialize an empty set to store the common letters
    val common = mutableSetOf<Char>()

    // Iterate over each character in name1
    for (char in name1Lower) {
        // Check if the character is a letter and if it exists in name2
        if (char.isLetter() && char in name2Lower) {
            // Add the common letter to the set
            common.add(char)
        }
    }

    return common
}
/**
 * Given two names, find the common letters between them.
 * For example, if name1 = "Johnny Depp" and name2 = "Penelope Cruz",
 * the common letters are 'e', 'o', and 'p'.
 *
 * @param name1 a string representing the first name.
 * @param name2 a string representing the second name.
 * @return a set containing the common letters between name1 and name2.
 */
fun commonLetters(name1: String, name2: String): Set<Char> {
/**
 * Given two names, find the common letters between them.
 * For example, if name1 = "Johnny Depp" and name2 = "Penelope Cruz",
 * the common letters are 'e', 'o', and 'p'.
 *
 * @param name1 a string representing the first name.
 * @param name2 a string representing the second name.
 * @return a set containing the common letters between name1 and name2.
 */
fun commonLetters(name1: String, name2: String): Set<Char> {

    // Convert the names to lowercase to make the comparison case-insensitive
    val name1Lower = name1.toLowerCase()
    val name2Lower = name2.toLowerCase()

    // Initialize an empty set to store the common letters
    val common = mutableSetOf<Char>()

    // Iterate over each character in name1
    for (char in name1Lower) {
        // Check if the character is a letter and if it exists in name2
        if (char.isLetter() && char in name2Lower) {
            // Add the common letter to the set
            common.add(char)
        }
    }

    return common
}