Event Emitter Basics

JavaScript Hard 5 views
Back to Questions

Problem Description

Process commands on an emitter: ON event, ONCE event, EMIT event, OFF event. Maintain how many times handler runs and print total at end.

Input Format

First line q. Next q lines commands.

Output Format

One integer totalCalls.

Sample Test Case

Input:
7 ON ping EMIT ping ONCE ping EMIT ping EMIT ping OFF ping EMIT ping
Output:
4

Constraints

1

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev