← Back to problems

38. Counter

BEGINNER
BeginnerLLDState

Keep a single counter that goes up and down, and report its value on request.

Keep a single integer counter that starts at 0. Process commands from stdin, one per line. Commands: - INCREMENT : add 1 to the counter. - DECREMENT : subtract 1 from the counter. - GET : print the counter's current value. The counter may go negative.
Log in to submit a solution

Comments

Log into join the discussion.