Online, offline and queued messages (Real-time Chat)

Users can be offline. disconnect <user (<user disconnected) and connect <user (<user connected, plus , <n queued and then each queued line as - <user: <message). Joining also connects. Messages to offline users are queued; the arrow lists only users who got the message now, or (nobody online); a DM to an offline user ends with - (<user offline, queued).

Input: As before.

Output: As before.

Difficulty: Medium. Write your answer in the browser editor, run the examples, then submit it against hidden tests. Python and JavaScript are free; other languages are part of licode Club.

Hint

  • A queue (list) per user of the exact lines they missed.

More Real-time Chat practice