/**
 * Given a list of names, find the characters that occur in all the names.
 *
 * @param names A list of strings representing names.
 * @return A list of characters that occur in all the names.
 */
fun findCommonChars(names: List<String>): List<Char> {

    val commonChars = mutableSetOf<Char>()

    for (char in names[0]) {
        var charExistsInAll = true

        for (name in names.subList(1, names.size)) {
            if (char !in name) {
                charExistsInAll = false
                break
            }
        }

        if (charExistsInAll) {
            commonChars.add(char)
        }
    }

    return commonChars.toList()
}
/**
 * Given a list of names, find the characters that occur in all the names.
 *
 * @param names A list of strings representing names.
 * @return A list of characters that occur in all the names.
 */
fun findCommonChars(names: List<String>): List<Char> {
/**
 * Given a list of names, find the characters that occur in all the names.
 *
 * @param names A list of strings representing names.
 * @return A list of characters that occur in all the names.
 */
fun findCommonChars(names: List<String>): List<Char> {

    val commonChars = mutableSetOf<Char>()

    for (char in names[0]) {
        var charExistsInAll = true

        for (name in names.subList(1, names.size)) {
            if (char !in name) {
                charExistsInAll = false
                break
            }
        }

        if (charExistsInAll) {
            commonChars.add(char)
        }
    }

    return commonChars.toList()
}