logo AlgoBeat OnlineJudge
登录 注册

#215730. [ICPC 2024 Jakarta R] Missing Separators

内存限制:1024 MiB 时间限制:1000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

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 that is a concatenation of all the words in the dictionary in the listed order.

Your task is to reconstruct the dictionary by splitting 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 ( . String 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 .

Then, output 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 .

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