Skip to content
← Back to the archive

13 September 2026

Chat Room Word Champion

Hard Strings Lists

Find who sent the highest share of long-word messages in a chat log.

You are given a chat log as a list of messages in the order they were sent. Each message names the username who sent it and its words, already split apart. A word counts as long when it has 5 or more characters. A message qualifies when it contains at least one long word. For each user, look at all of that user's messages. Find the fraction of their messages that qualify: their qualifying message count divided by their total message count. Return the username with the highest qualifying fraction. If two or more users are tied for the highest fraction, return whichever username comes first alphabetically.

Constraints

  • messages has between 1 and 500 entries
  • username has between 1 and 20 lowercase letters
  • each message has between 0 and 30 words
  • each word has between 1 and 20 lowercase letters

Function signature

def top_qualifying_fraction_user(messages):

Sign in to solve this bracket

Reading the problem is free for everyone. Opening the editor and solving it requires an account with Open Bracket+.