/**
 * Calculate the total expenses for the given number of months, where each month's expenses are represented
 * as a string with numbers separated by a space.
 *
 * @param months The number of months.
 * @param expenses The string representing each month's expenses.
 * @return The total expenses.
 */
fun calculateTotalExpenses(months: Int, expenses: String): Int {

    var totalExpenses = 0

    // Iterate over each month
    repeat(months) {
        // Iterate over each character in the expenses string
        for (char in expenses) {
            // Check if the character is a number
            if (char.isDigit()) {
                // Convert the character to an integer and add it to the total expenses
                totalExpenses += Character.getNumericValue(char)
            }
        }
    }

    return totalExpenses
}
/**
 * Calculate the total expenses for the given number of months, where each month's expenses are represented
 * as a string with numbers separated by a space.
 *
 * @param months The number of months.
 * @param expenses The string representing each month's expenses.
 * @return The total expenses.
 */
fun calculateTotalExpenses(months: Int, expenses: String): Int {
/**
 * Calculate the total expenses for the given number of months, where each month's expenses are represented
 * as a string with numbers separated by a space.
 *
 * @param months The number of months.
 * @param expenses The string representing each month's expenses.
 * @return The total expenses.
 */
fun calculateTotalExpenses(months: Int, expenses: String): Int {

    var totalExpenses = 0

    // Iterate over each month
    repeat(months) {
        // Iterate over each character in the expenses string
        for (char in expenses) {
            // Check if the character is a number
            if (char.isDigit()) {
                // Convert the character to an integer and add it to the total expenses
                totalExpenses += Character.getNumericValue(char)
            }
        }
    }

    return totalExpenses
}