← CSES Better

SMS Dictionary

INOI · 2007 · Indian National Olympiad in Informatics · INOI0701

Open official problem ↗
Ask AI

Open a hint-first prompt in a new AI chat. Grok may ask you to confirm before sending.

Open Claude Desktop

strings · grouping · frequency-counting

The organizer’s problem statement is available at the official source link.

phone key groups

Find the key sequence matching the most dictionary words

Map each dictionary word to its phone-key sequence, group equal sequences, and choose a largest group.

State table
Dictionary wordPhone key sequenceGroup count
word wkey(w)count matching words
all wgroup by key(w)choose maximum group
  1. 1

    Map each word to keys

    Replace each letter by the number key assigned to its letter group.
  2. 2

    Group equal sequences

    Words that map to the same digit string form one group.
  3. 3

    Choose the largest group

    Output a digit string whose group contains the most dictionary words.
Tools
1
2
3
4
5
6
7
8
9
10
11
12
Draft saved locally
|12 lines, 156 chars

Run output

Run your code to see output.