/**
 * This function takes two strings as input and finds the number of common characters present in both strings.
 * It uses a for loop in combination with other functions to solve the exercise.
 */
fun countCommonChars(string1: String, string2: String): Int {

    // Initialize a variable to store the count of common characters
    var commonCount = 0

    // Iterate through each character in the first string
    for (char in string1) {
        // Check if the character exists in both strings and is not already counted
        if (char in string2 && char !in string1.substring(0, string1.indexOf(char))) {
            // Increment the count by 1
            commonCount++
        }
    }

    // Return the final count of common characters
    return commonCount
}
/**
 * This function takes two strings as input and finds the number of common characters present in both strings.
 * It uses a for loop in combination with other functions to solve the exercise.
 */
fun countCommonChars(string1: String, string2: String): Int {
/**
 * This function takes two strings as input and finds the number of common characters present in both strings.
 * It uses a for loop in combination with other functions to solve the exercise.
 */
fun countCommonChars(string1: String, string2: String): Int {

    // Initialize a variable to store the count of common characters
    var commonCount = 0

    // Iterate through each character in the first string
    for (char in string1) {
        // Check if the character exists in both strings and is not already counted
        if (char in string2 && char !in string1.substring(0, string1.indexOf(char))) {
            // Increment the count by 1
            commonCount++
        }
    }

    // Return the final count of common characters
    return commonCount
}