프로그램 명: ioi_printer(special jduge)
제한시간: 1 초
//번역//

You need to print N words on a movable type printer. Movable type printers are those old printers that require you to place small metal pieces (each containing a letter) in order to form words. A piece of paper is then pressed against them to print the word. The printer you have allows you to do any of the following operations:

Initially, the printer is empty; it contains no metal pieces with letters. At the end of printing, you are allowed to leave some letters in the printer. Also, you are allowed to print the words in any order you like.

As every operation requires time, you want to minimize the total number of operations.

TASK

You must write a program that, given the N words you want to print, finds the minimum number of operations needed to print all the words in any order, and outputs one such sequence of operations.

CONSTRAINTS

1 <= N <= 25,000 The number of words you need to print.

입력

Your program must read from the standard input the following data:

출력

Your program must write to the standard output the following data:

입출력 예

입력

3
print
the
poem

출력

20
t
h
e
P
-
-
-
p
o
e
m
P
-
-
-
r
i
n
t
P

GRADING

For a number of tests, worth a total of 40 points, N will not exceed 18.
출처: International Olympiad In Informatics 2008
special judge: august14

[질/답] [제출 현황] [푼 후(0)]
[ 채 점 ] [홈으로]  [뒤 로]