Problems
Farmer John is trying to describe his favorite USACO contest to Elsie, but she is having trouble understanding why he likes it so much. He says "My favorite part of the contest was when Bessie said 'It's Mooin' Time' and mooed all over the contest."
Elsie still doesn't understand so Farmer John downloads the contest as a text file and tries to explain what he means. The contest is defined as a string of lowercase letters of length
However, Farmer John's download might have been corrupted, and the text file might have up to one character that differs from the original file. Print all possible moos that Bessie could have made taking the potential error into account, sorted in alphabetical order.
Input
The first line contains
The second line contains a string of lowercase letters of length
Output
Print out the number of possible moos that Bessie makes, followed by a lexicographically sorted list of the moos. Each moo should appear on a separate line.
Subtask
| # | Score | Condition |
|---|---|---|
| #1 | 30 | |
| #2 | 70 | |
Example #1
10 2
zzmoozzmoo
1
moo
In this case, no character change affects the answer. The only moo Bessie made was "moo".
Example #2
17 2
momoobaaaaaqqqcqq
3
aqq
baa
cqq
In this case, the
Example #3
3 1
ooo
25
aoo
boo
coo
doo
eoo
foo
goo
hoo
ioo
joo
koo
loo
moo
noo
poo
qoo
roo
soo
too
uoo
voo
woo
xoo
yoo
zoo