Old cellphones did not used to have QWERTY keyboards. So, typing text was by pressing numeric keys:
1 2 3 4 5 6 7 8 9 |
|
There was something called a T9 predictor which allowed the user to express a word by pressing corresponding keys just once. For example, if the user typed in
274554268
, the predictor would predict
Brilliant
.
Indeed, it is possible that there are two words which can be represented using the same sequence of digits. In this case, the user could switch between them at his discretion.
What is the sequence of digits for which there are largest number of clashes, if all the words are from this dictionary ?
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
The best way to solve this problem as far as I know is to use an associative array , or what is called a dictionary in Python.
The
toT9
is simple to code up:Then, we load the file and sort create the frequency distribution table:
To extract the entry with the maximum number of clashes, we do the following:
That gives us
22737
. It has 12 clashes.In fact, these 12 words are: