/**
 * The function takes a string as input and returns a pair containing characters that appear more than once in the string
 * and the total count of those characters.
 *
 * @param string A string to search for duplicate characters.
 * @return Pair A pair containing the duplicate characters and their count.
 *
 * Example:
 * findCharactersInString("fashion") returns Pair(listOf('a', 's', 'i'), 3)
 */
fun findCharactersInString(string: String): Pair<List<Char>, Int> {

    val duplicates = mutableListOf<Char>()

    for (char in string) {
        if (string.count { it == char } > 1 && char !in duplicates) {
            duplicates.add(char)
        }
    }

    return Pair(duplicates, duplicates.size)
}
/**
 * The function takes a string as input and returns a pair containing characters that appear more than once in the string
 * and the total count of those characters.
 *
 * @param string A string to search for duplicate characters.
 * @return Pair A pair containing the duplicate characters and their count.
 *
 * Example:
 * findCharactersInString("fashion") returns Pair(listOf('a', 's', 'i'), 3)
 */
fun findCharactersInString(string: String): Pair<List<Char>, Int> {
/**
 * The function takes a string as input and returns a pair containing characters that appear more than once in the string
 * and the total count of those characters.
 *
 * @param string A string to search for duplicate characters.
 * @return Pair A pair containing the duplicate characters and their count.
 *
 * Example:
 * findCharactersInString("fashion") returns Pair(listOf('a', 's', 'i'), 3)
 */
fun findCharactersInString(string: String): Pair<List<Char>, Int> {

    val duplicates = mutableListOf<Char>()

    for (char in string) {
        if (string.count { it == char } > 1 && char !in duplicates) {
            duplicates.add(char)
        }
    }

    return Pair(duplicates, duplicates.size)
}