Event Subscriptions (Topic Bus)

Programming Interview Hard 9 views
Back to Questions

Problem Description

Commands: SUB user topic, UNSUB user topic, PUB topic msg(no spaces). For each PUB print how many users receive the message.

Input Format

See description.

Output Format

See description.

Sample Test Case

Input:
6 SUB u1 sports SUB u2 sports SUB u1 tech PUB sports hi UNSUB u2 sports PUB sports yo
Output:
2 1

Constraints

Total operations up to 200000.

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev