License plates
In the investigation of road traffic accidents, challenges often arise in locating vehicles whose drivers have fled the scene.
Gathering witness statements is particularly difficult. Witnesses frequently can only recall the vehicle's number approximately, and there is a high likelihood that they might confuse the order of digits or letters in the number.
Given the number provided by a witness, calculate how many different numbers can be formed by rearranging the letters and/or digits, and list all such numbers.
Remember, vehicle numbers in Russia consist of three letters and three digits, arranged as follows: one letter, followed by three digits, and then two letters. The regional identifier of the vehicle's registration will be ignored.
The following letters may appear in the number: "A", "B", "C", "E", "H", "K", "M", "O", "P", "T", "X", "Y" (these letters have similar forms in both the Russian and Latin alphabets). In this task, the input will use letters from the Latin alphabet.
Input
The program receives a single line of input, which is a valid vehicle number.
Output
On the first line, output the number k - the total number of different numbers that can be generated by rearranging the letters and/or digits of the given number.
In the following k lines, list all such numbers in any order.