DWITE Online Computer Programming Contest, November 2007, Problem 2
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 balance is rolled over from one day to the next. Negative balance is a special event that will reset the balance to
The input will contain five lines, each no more than +
or -
each representing addition and subtraction of one unit from the running balance.
The output will contain five lines. Each line will have an integer, representing a balance at the end of that day's datastream. If the balance drops below OH NOES!
should be printed to that line instead, and have the balance be reset back to
Sample Input
+++
++-
-----++++++++++
++-+
--++
Sample Output
3
4
OH NOES!
2
2
Problem Resource: DWITE
Comments