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

View as PDF

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

Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig
##### 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. In a case that 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. Use the exact string output, all upper case, without quotes.

#### Sample Input

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

#### Sample Output

3
4
OH NOES!
2
2