/**
 * As an accountant, you are tasked with calculating the remaining budget
 * after deducting the expenses. The budget and expenses are represented
 * by positive integers. Use a while loop to continuously subtract the
 * expenses from the budget until the budget becomes negative.
 *
 * @param budget The initial budget.
 * @param expenses A string containing the expenses separated by spaces.
 * @return The remaining budget after deducting the expenses.
 */
fun calculateSalary(budget: Int, expenses: String): Int {

    val expenseList = expenses.split(" ")
    var remainingBudget = budget
    var i = 0
    while (i < expenseList.size && remainingBudget >= 0) {
        remainingBudget -= expenseList[i].toInt()
        i++
    }
    return remainingBudget
}
/**
 * As an accountant, you are tasked with calculating the remaining budget
 * after deducting the expenses. The budget and expenses are represented
 * by positive integers. Use a while loop to continuously subtract the
 * expenses from the budget until the budget becomes negative.
 *
 * @param budget The initial budget.
 * @param expenses A string containing the expenses separated by spaces.
 * @return The remaining budget after deducting the expenses.
 */
fun calculateSalary(budget: Int, expenses: String): Int {
/**
 * As an accountant, you are tasked with calculating the remaining budget
 * after deducting the expenses. The budget and expenses are represented
 * by positive integers. Use a while loop to continuously subtract the
 * expenses from the budget until the budget becomes negative.
 *
 * @param budget The initial budget.
 * @param expenses A string containing the expenses separated by spaces.
 * @return The remaining budget after deducting the expenses.
 */
fun calculateSalary(budget: Int, expenses: String): Int {

    val expenseList = expenses.split(" ")
    var remainingBudget = budget
    var i = 0
    while (i < expenseList.size && remainingBudget >= 0) {
        remainingBudget -= expenseList[i].toInt()
        i++
    }
    return remainingBudget
}