| acmsguru |
|---|
| Finished |
" is abbreviated to "
". Unfortunately, for single-letter words this rule leads to a word lengthening. For example, word "
" will be written as "
".
for a given vocabulary, if there are no words from vocabulary that can be entered using the same two-buttons sequence.
", "
" and "
", two buttons are enough for creating the keyboard. The first button will have "
" and "
", the second button — "
". The placement like "
" and "
" on the first button, "
" on the second button will not work, because words "
" and "
" can be entered using the same sequence of buttons.
placement is any correct placement with the minimal possible number of buttons used for the given Berland alphabet. sample input | sample output |
3 3 ab aa bc | 2 ac b |
sample input | sample output |
4 2 ab cd | 2 cb ad |
sample input | sample output |
5 4 aa bb cc dd | 4 ae b c d |
| Name |
|---|


