## DWITE '07 R2 #2 - Show Me The Money!

View as PDF

Points: 3
Time limit: 2.0s
Memory limit: 64M

Problem type
##### 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 at the end of that day.

The input will contain five lines, each no more than 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 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 during any particular stream, OH NOES! should be printed to that line instead, and have the balance be reset back to , regardless of what follows on that line.

#### Sample Input

+++
++-
-----++++++++++
++-+
--++

#### Sample Output

3
4
OH NOES!
2
2

Problem Resource: DWITE