/**
 * This exercise requires finding the common characters between two strings using loops and the modulus operation.
 *
 * @param string1 The first string.
 * @param string2 The second string.
 * @return A list containing the common characters between the two strings.
 */
fun findCommonChars(string1: String, string2: String): List<Char> {

    val commonChars = mutableListOf<Char>()  // List to store common characters
    
    for (char in string1) {  // Loop through each character in string1
        if (char in commonChars) {  // If the character is already in the commonChars list, skip it
            continue
        }
        for (i in string2.indices) {  // Loop through each character in string2
            if (string2[i] == char) {  // If the character is found in string2
                if (i % 2 == 0) {  // Check if the index is even using modulus operation
                    commonChars.add(char)  // Add the character to commonChars list
                    break
                }
            }
        }
    }
    
    return commonChars
}
/**
 * This exercise requires finding the common characters between two strings using loops and the modulus operation.
 *
 * @param string1 The first string.
 * @param string2 The second string.
 * @return A list containing the common characters between the two strings.
 */
fun findCommonChars(string1: String, string2: String): List<Char> {
/**
 * This exercise requires finding the common characters between two strings using loops and the modulus operation.
 *
 * @param string1 The first string.
 * @param string2 The second string.
 * @return A list containing the common characters between the two strings.
 */
fun findCommonChars(string1: String, string2: String): List<Char> {

    val commonChars = mutableListOf<Char>()  // List to store common characters
    
    for (char in string1) {  // Loop through each character in string1
        if (char in commonChars) {  // If the character is already in the commonChars list, skip it
            continue
        }
        for (i in string2.indices) {  // Loop through each character in string2
            if (string2[i] == char) {  // If the character is found in string2
                if (i % 2 == 0) {  // Check if the index is even using modulus operation
                    commonChars.add(char)  // Add the character to commonChars list
                    break
                }
            }
        }
    }
    
    return commonChars
}