Problems

Batched State Updates

MediumComponent Lifecycle

Inside one event handler, multiple setState calls batch into ONE render. Input: each line is one event handler containing space-separated deltas (e.g. +1 +1 -2). State starts at 0. Print two lines: final state and total render count (one per event line).

Input: one handler per line. Output: final state, then render count.

Your program reads from stdin and prints to stdout.

Example 1

Input: +1 +1 +1

Output: 3 1

Hints

ReactLifecycleBatching