097. Neon Lights

Codeforces
IDCF10269097
Time1000ms
Memory256MB
Difficulty
English · Original
Formal · Original
Neon Lights You are trying to find strings of text to put on neon lights. You want to fully test the extent of the neon lights' writing style for letters, so you want to pick the string of text that has the highest number of distinct (different) letters from a selection of possible strings of text. The first line of input contains a positive integer $n$ indicating the number of strings of text that you are considering putting on neon lights. The next $n$ lines each contain each string of text, consisting of only lowercase letters and spaces. Output the string of text from the possibilities which has the highest number of distinct letters. If two strings of text contain the same number of distinct letters, choose the one that comes first in the input file. ## Input The first line of input contains a positive integer $n$ indicating the number of strings of text that you are considering putting on neon lights. The next $n$ lines each contain each string of text, consisting of only lowercase letters and spaces. ## Output Output the string of text from the possibilities which has the highest number of distinct letters. If two strings of text contain the same number of distinct letters, choose the one that comes first in the input file. [samples]
**Definitions** Let $ n \in \mathbb{Z}^+ $ be the number of strings. Let $ S = (s_1, s_2, \dots, s_n) $ be a sequence of strings, where each $ s_i $ is a string over the alphabet $ \Sigma = \{a, b, \dots, z\} \cup \{\text{space}\} $. **Constraints** 1. $ n \geq 1 $ 2. Each $ s_i $ contains only lowercase English letters and spaces. **Objective** Find the string $ s_k \in S $ such that: $$ k = \min\left\{ i \in \{1, \dots, n\} \mid | \text{distinct letters in } s_i | = \max_{1 \leq j \leq n} | \text{distinct letters in } s_j | \right\} $$ where "distinct letters" excludes spaces and considers only characters in $ \{a, b, \dots, z\} $.
API Response (JSON)
{
  "problem": {
    "name": "097. Neon Lights",
    "description": {
      "content": "Neon Lights You are trying to find strings of text to put on neon lights. You want to fully test the extent of the neon lights' writing style for letters, so you want to pick the string of text that ",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF10269097"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Neon Lights\n\nYou are trying to find strings of text to put on neon lights. You want to fully test the extent of the neon lights' writing style for letters, so you want to pick the string of text that ...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ n \\in \\mathbb{Z}^+ $ be the number of strings.  \nLet $ S = (s_1, s_2, \\dots, s_n) $ be a sequence of strings, where each $ s_i $ is a string over the alphabet $ \\Sigma = \\{a, b...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments