/**
 * This exercise aims to find the common characters between two strings using slicing.
 *
 * @param str1 The first string.
 * @param str2 The second string.
 * @return A list containing the common characters.
 */
fun findCommonCharacters(str1: String, str2: String): List<Char> {

    // Initialize an empty list to store the common characters
    val commonCharacters = mutableListOf<Char>()

    // Iterate through each character in the first string
    for (char in str1) {
        // Check if the character is present in the second string and not already in commonCharacters
        if (char in str2 && char !in commonCharacters) {
            // Add the character to the commonCharacters list
            commonCharacters.add(char)
        }
    }

    // Return the list of common characters
    return commonCharacters
}
/**
 * This exercise aims to find the common characters between two strings using slicing.
 *
 * @param str1 The first string.
 * @param str2 The second string.
 * @return A list containing the common characters.
 */
fun findCommonCharacters(str1: String, str2: String): List<Char> {
/**
 * This exercise aims to find the common characters between two strings using slicing.
 *
 * @param str1 The first string.
 * @param str2 The second string.
 * @return A list containing the common characters.
 */
fun findCommonCharacters(str1: String, str2: String): List<Char> {

    // Initialize an empty list to store the common characters
    val commonCharacters = mutableListOf<Char>()

    // Iterate through each character in the first string
    for (char in str1) {
        // Check if the character is present in the second string and not already in commonCharacters
        if (char in str2 && char !in commonCharacters) {
            // Add the character to the commonCharacters list
            commonCharacters.add(char)
        }
    }

    // Return the list of common characters
    return commonCharacters
}