English

2만 단어 사전에서 무작위로 추출한 일부 단어가 주어질 때, 26개 알파벳이 각각 정확히 한 번씩만 나타나도록 입력 단어를 최대 8개 고른다.

어려움8백트래킹완전 탐색비트 연산문자열 매칭아직 제출이 없습니다시간 제한3초메모리 제한256 MB

문제

Sophie wants to learn the English letters and she asked Johnny for help. He wants to prepare a set of words so that each letter appears in one of them and as Johnny does not like to repeat himself, each letter should appear in exactly one word (exactly once). Sophie does not fully trust Johnny--he pulled her leg too many times before--so she wants to verify that the words are in her English dictionary. Unfortunately, she spilled some tea over it and all one- and two-letter words are now unreadable and all other words are unreadable with a probability 1/21/2. Help Johnny--write a program that reads the list of readable words from the dictionary and computes the set of words according to the requirements. Luckily, Johnny has the same dictionary as Sophie (also with no one- nor two-letter words, but with all other words readable), he can share it with you so that you can prepare a bit. Furthermore Sophie personally guarantees that you can choose the requested set of words from 20k.unix.txt.

입력

The first line of the input consists of a single positive integer nn of words in the dictionary (1n20,0001 \le n \le 20\\,000). The following nn lines contain lexicographically-sorted words of length at least 33, one word per line. Each test file was randomly generated from a dictionary that contains 20,00020\\,000 words (each of length at least 33), i.e.  each word was put in the file independently with a probability 1/21/2.

출력

You should write a single positive integer kk (1k81 \le k \le 8) in the first line of the output. In the following kk lines you should write kk words, one per line. Each of those words should appear in the input dictionary and each letter of the English alphabet, which contains 26 letters in total, should appear exactly once in exactly one of those words. It is guaranteed that for each input file there is a solution.

힌트

Due to space constraints, the dictionary in the example was not created randomly and it is presented only to demonstrate the constraints on the solution. In particular, it will not be used for  testing the correctness of your solution. Nevertheless, the seven words in the output contain all 26 letters of the English alphabet, each exactly once.