/**
 * This exercise requires you, as an anthropologist, to find the common characters between two strings.
 *
 * You will be provided with two strings, string1 and string2. Your task is to write a function that returns a list
 * containing the common characters found in both strings. The order of the characters in the returned list should
 * follow the order of occurrence in string1.
 *
 * Here's an example:
 *
 * If string1 = "hello" and string2 = "world", the common characters are 'o' and 'l' because both strings contain
 * these characters. Therefore, the function should return ['l', 'o'].
 *
 * Your code should not be case-sensitive, meaning that 'L' and 'l' should be considered the same character.
 *
 * Your task is to complete the code below to solve this exercise.
 */
fun findCommonCharacters(string1: String, string2: String): List<Char> {

    val commonChars = mutableListOf<Char>()
    for (char in string1) {
        if (char.toLowerCase() in string2.toLowerCase() && char !in commonChars) {
            commonChars.add(char)
        }
    }
    return commonChars
}
/**
 * This exercise requires you, as an anthropologist, to find the common characters between two strings.
 *
 * You will be provided with two strings, string1 and string2. Your task is to write a function that returns a list
 * containing the common characters found in both strings. The order of the characters in the returned list should
 * follow the order of occurrence in string1.
 *
 * Here's an example:
 *
 * If string1 = "hello" and string2 = "world", the common characters are 'o' and 'l' because both strings contain
 * these characters. Therefore, the function should return ['l', 'o'].
 *
 * Your code should not be case-sensitive, meaning that 'L' and 'l' should be considered the same character.
 *
 * Your task is to complete the code below to solve this exercise.
 */
fun findCommonCharacters(string1: String, string2: String): List<Char> {
/**
 * This exercise requires you, as an anthropologist, to find the common characters between two strings.
 *
 * You will be provided with two strings, string1 and string2. Your task is to write a function that returns a list
 * containing the common characters found in both strings. The order of the characters in the returned list should
 * follow the order of occurrence in string1.
 *
 * Here's an example:
 *
 * If string1 = "hello" and string2 = "world", the common characters are 'o' and 'l' because both strings contain
 * these characters. Therefore, the function should return ['l', 'o'].
 *
 * Your code should not be case-sensitive, meaning that 'L' and 'l' should be considered the same character.
 *
 * Your task is to complete the code below to solve this exercise.
 */
fun findCommonCharacters(string1: String, string2: String): List<Char> {

    val commonChars = mutableListOf<Char>()
    for (char in string1) {
        if (char.toLowerCase() in string2.toLowerCase() && char !in commonChars) {
            commonChars.add(char)
        }
    }
    return commonChars
}