Rate limits and moderation (Real-time Chat)
Protect the room. T <second sets the clock. LIMIT <n <seconds: a user may send at most n messages in any window of that many seconds; more prints rate limited: <user (try again in <ss) where s is when the oldest message in the window expires. BAN <word masks that word (whole word, any case) with of the same length in later messages. mute <user / unmute <user (<user muted|unmuted); a muted user’s messages print error: <user is muted.
Input: As before, plus T, LIMIT, BAN, mute.
Output: As before.
Difficulty: Hard. 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
- Keep each user’s recent send times and drop those outside the window.