/**
 * The function takes in two lists, nurseNames and doctorNames,
 * and returns a string containing all the letters that are common
 * between the two lists.
 *
 * The function should use a ternary operator to check if each letter
 * in the nurse's name exists in the doctor's name. If yes, the letter
 * should be added to the result string.
 *
 * Lastly, the function should use a for loop to iterate through each
 * character in the result string and print it.
 *
 * @param nurseNames A list of nurse names
 * @param doctorNames A list of doctor names
 */
fun findCommonLetters(nurseNames: List<String>, doctorNames: List<String>) {

    var commonLetters = ""

    for (nurseName in nurseNames) {
        for (doctorName in doctorNames) {
            commonLetters += nurseName.filter { it in doctorName }
        }
    }

    for (letter in commonLetters) {
        println(letter)
    }
}
/**
 * The function takes in two lists, nurseNames and doctorNames,
 * and returns a string containing all the letters that are common
 * between the two lists.
 *
 * The function should use a ternary operator to check if each letter
 * in the nurse's name exists in the doctor's name. If yes, the letter
 * should be added to the result string.
 *
 * Lastly, the function should use a for loop to iterate through each
 * character in the result string and print it.
 *
 * @param nurseNames A list of nurse names
 * @param doctorNames A list of doctor names
 */
fun findCommonLetters(nurseNames: List<String>, doctorNames: List<String>) {
/**
 * The function takes in two lists, nurseNames and doctorNames,
 * and returns a string containing all the letters that are common
 * between the two lists.
 *
 * The function should use a ternary operator to check if each letter
 * in the nurse's name exists in the doctor's name. If yes, the letter
 * should be added to the result string.
 *
 * Lastly, the function should use a for loop to iterate through each
 * character in the result string and print it.
 *
 * @param nurseNames A list of nurse names
 * @param doctorNames A list of doctor names
 */
fun findCommonLetters(nurseNames: List<String>, doctorNames: List<String>) {

    var commonLetters = ""

    for (nurseName in nurseNames) {
        for (doctorName in doctorNames) {
            commonLetters += nurseName.filter { it in doctorName }
        }
    }

    for (letter in commonLetters) {
        println(letter)
    }
}