/**
 * This function checks if the given segment matches any of the contacts
 * and returns those contacts that match.
 *
 * @param segment The segment to check against.
 * @param contacts A list containing the contacts to be checked.
 * @return A list of contacts that match the given segment.
 */
fun checkContacts(segment: String, contacts: List<String>): List<String> {

    // Initialize an empty list to store matching contacts
    val matchingContacts = mutableListOf<String>()

    // Iterate over each contact in the contacts list
    for (contact in contacts) {
        // Check if the segment is in the contact
        if (contact.contains(segment)) {
            // If the segment is found in the contact, add it to the matchingContacts list
            matchingContacts.add(contact)
        }
    }

    // Return the final list of matching contacts
    return matchingContacts
}
/**
 * This function checks if the given segment matches any of the contacts
 * and returns those contacts that match.
 *
 * @param segment The segment to check against.
 * @param contacts A list containing the contacts to be checked.
 * @return A list of contacts that match the given segment.
 */
fun checkContacts(segment: String, contacts: List<String>): List<String> {
/**
 * This function checks if the given segment matches any of the contacts
 * and returns those contacts that match.
 *
 * @param segment The segment to check against.
 * @param contacts A list containing the contacts to be checked.
 * @return A list of contacts that match the given segment.
 */
fun checkContacts(segment: String, contacts: List<String>): List<String> {

    // Initialize an empty list to store matching contacts
    val matchingContacts = mutableListOf<String>()

    // Iterate over each contact in the contacts list
    for (contact in contacts) {
        // Check if the segment is in the contact
        if (contact.contains(segment)) {
            // If the segment is found in the contact, add it to the matchingContacts list
            matchingContacts.add(contact)
        }
    }

    // Return the final list of matching contacts
    return matchingContacts
}