Litsey o`quvchilar uchun |
---|
Finished |
Your first mission is to find the password of the Martian database. To achieve this, your best secret agents have already discovered the following facts:
A palindrome is a string that reads the same backwards. racecar, bob, and noon are famous examples.
Given those facts, can you find all possible passwords of the database?
The first line contains n, the length of the input string (1 ≤ n ≤ 105).
The next line contains a string of length n. Every character of this string is a digit.
The digits in the string are in non-decreasing order.
On the first line, print the number of possible passwords, k.
On the next k lines, print the possible passwords in alphabetical order.
8
34456788
2
44
88
1
0
1
0
You can easily convert a digit encoded as a character to an integer:
(int)('1' - '0') will give you 1 for instance, in C++ or Java.
int('4' - '0') will give you 4 in Python.
Name |
---|