DWITE Online Computer Programming Contest
November 2007
Problem 2
Show Me The Money!

The task is to create a small application that will monitor financial transactions and keep a running total, displaying the balance at the end of each day. It should be assumed that the initial balance is zero, and the balance is rolled over from one day to the next. A negative balance is a special event that will reset the balance to 0 at the end of that day.

The input file DATA2.txt will contain five lines, each no more than 255 characters long. Each line represents a stream of transactions with two possible characters + or -, each representing addition and subtraction of one unit from the running balance.

The output file OUT2.txt will contain five lines. Each line will have an integer, representing a balance at the end of that day's datastream. In the case that the balance drops below 0 during any particular stream, "OH NOES!" should be printed to that line instead, and have the balance be reset back to 0, regardless of what follows on that line. Use the exact string output, all upper case, without quotes.

Sample Input:
Sample Output: