#C7952. Bank Account Operations
Bank Account Operations
Bank Account Operations
You are given a series of operations on a bank account. Initially, the account balance is \(0\). Each operation is provided in the form of a string: either "deposit X" or "withdraw X", where \(X\) is a positive integer.
For a deposit operation, the account balance increases by \(X\). For a withdraw operation, if the account has at least \(X\) in the balance, then \(X\) is deducted; otherwise, the balance remains unchanged.
Process all the operations and output the final balance.
inputFormat
The input is read from stdin and has the following format:
- The first line contains an integer \(n\), representing the number of operations.
- The next \(n\) lines each contain a single operation in the format "deposit X" or "withdraw X".
outputFormat
Output a single integer (to stdout) that represents the final balance of the bank account after processing all operations.
## sample6
deposit 100
withdraw 50
withdraw 10
deposit 70
withdraw 150
deposit 30
140