Skip to content
LakeBench
ProblemsCommunityPricing
Sign inStart practicing

Most common word in a support ticket

Python data engineering interview problem. Difficulty: beginner. Pattern: Strings. About 10 minutes. Part of the Pro drill bank.

Support tickets arrive as messy free text. A triage job needs the single most common word so agents can tag the queue (login, refund, shipping) without reading every ticket.

From a block of ticket text, return the one most frequent word after normalizing case and dropping punctuation.

Requirements

  • Ignore capitalization: 'Blue' and 'blue' are the same word.
  • Keep only alphanumeric word tokens.
  • If several words share the top count, return the lexicographically smallest.
  • If there are no tokens, return an empty string.

Constraints

  • Hidden tests include punctuation-only text and one-word tickets.

Examples

Input: most_common_word('Red red BLUE blue blue') Output: 'blue' This input follows the stated rules and produces this output.

Topics: lakebench, python, strings.

More Python interview questions · All interview problems · Learn data engineering

beginner

Most common word in a support ticket

Interview-style drill: Given a block of ticket text, return the single most frequent word.

From a block of ticket text, return the one most frequent word after normalizing case and dropping punctuation.