Logo
(追記) (追記ここまで)

33126번 - Missing Separators 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 2048 MB105332835.897%

문제

You have a dictionary, which is a list of distinct words sorted in alphabetical order. Each word consists of uppercase English letters.

You want to print this dictionary. However, there is a bug with the printing system, and all words in the list are printed next to each other without any separators between words. Now, you ended up with a string $S$ that is a concatenation of all the words in the dictionary in the listed order.

Your task is to reconstruct the dictionary by splitting $S$ into one or more words. Note that the reconstructed dictionary must consist of distinct words sorted in alphabetical order. Furthermore, you want to maximize the number of words in the dictionary. If there are several possible dictionaries with the maximum number of words, you can choose any of them.

입력

A single line consisting of a string $S$ (1ドル ≤ |S| ≤ 5000$). String $S$ consists of only uppercase English letters.

출력

First, output an integer in a single line representing the maximum number of the words in the reconstructed dictionary. Denote this number as $n$.

Then, output $n$ lines, each containing a single string representing the word. The words must be distinct, and the list must be sorted alphabetically. The concatenation of the words in the listed order must equal $S$.

If there are several possible dictionaries with the maximum number of words, output any of them.

제한

예제 입력 1

ABACUS

예제 출력 1

4
A
BA
C
US

예제 입력 2

AAAAAA

예제 출력 2

3
A
AA
AAA

예제 입력 3

EDCBA

예제 출력 3

1
EDCBA

힌트

출처

ICPC > Regionals > Asia Pacific > Indonesia > Jakarta > The 2024 ICPC Asia Jakarta Regional Contest H번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /