/**
 * Given a dictionary where the keys are the names of accountants and the values are sets of transactions,
 * find the common transactions among all accountants.
 *
 * @param accountants A dictionary where the keys are the names of accountants (strings) and the values are
 * sets of transactions (sets of strings).
 * @return A set of strings representing the common transactions among all accountants.
 * @throws IllegalArgumentException If the dictionary is empty or if any accountant has no transactions.
 */
fun getCommonTransactions(accountants: Map<String, Set<String>>): Set<String> {

    // Check if the dictionary is empty
    if (accountants.isEmpty()) {
        throw IllegalArgumentException("The dictionary cannot be empty")
    }

    // Get the transactions of the first accountant
    val firstAccountant = accountants.values.first()
    var commonTransactions = firstAccountant.toMutableSet()

    // Iterate through the transactions of the remaining accountants
    for (accountant in accountants.values) {
        // Check if the accountant has transactions
        if (accountant.isEmpty()) {
            throw IllegalArgumentException("An accountant should have at least one transaction")
        }

        // Update the common transactions
        commonTransactions.retainAll(accountant)
    }

    return commonTransactions
}
/**
 * Given a dictionary where the keys are the names of accountants and the values are sets of transactions,
 * find the common transactions among all accountants.
 *
 * @param accountants A dictionary where the keys are the names of accountants (strings) and the values are
 * sets of transactions (sets of strings).
 * @return A set of strings representing the common transactions among all accountants.
 * @throws IllegalArgumentException If the dictionary is empty or if any accountant has no transactions.
 */
fun getCommonTransactions(accountants: Map<String, Set<String>>): Set<String> {
/**
 * Given a dictionary where the keys are the names of accountants and the values are sets of transactions,
 * find the common transactions among all accountants.
 *
 * @param accountants A dictionary where the keys are the names of accountants (strings) and the values are
 * sets of transactions (sets of strings).
 * @return A set of strings representing the common transactions among all accountants.
 * @throws IllegalArgumentException If the dictionary is empty or if any accountant has no transactions.
 */
fun getCommonTransactions(accountants: Map<String, Set<String>>): Set<String> {

    // Check if the dictionary is empty
    if (accountants.isEmpty()) {
        throw IllegalArgumentException("The dictionary cannot be empty")
    }

    // Get the transactions of the first accountant
    val firstAccountant = accountants.values.first()
    var commonTransactions = firstAccountant.toMutableSet()

    // Iterate through the transactions of the remaining accountants
    for (accountant in accountants.values) {
        // Check if the accountant has transactions
        if (accountant.isEmpty()) {
            throw IllegalArgumentException("An accountant should have at least one transaction")
        }

        // Update the common transactions
        commonTransactions.retainAll(accountant)
    }

    return commonTransactions
}