|
Sena |
Hello, Sensei. Our Medical Emergency Club transports corpses... Pardon me. Patients. |
|
Sena |
There was a minor accident yesterday, leaving some cor... to be transported to the Medical Emergency Club room. |
|
Sena |
...Some injured patients. Fortunately, it was nothing serious. They all ate a terrible sauce and passed out because it tasted so awful. |
|
Sena |
We must always keep our medicines organized to care for our patients. However... there were so many patients today that I have not had the chance. |
|
Sena |
So, Sensei, would you be able to help me organize the medicines? |
The first line contains a positive integer .
The second line contains , , , without spaces. All characters are uppercase English letters.
On the first line, print the minimum number of distinct types of medicine.
On the second line, print , , , without spaces, representing the final arrangement. Only uppercase English letters may be used to represent types of medicine.
At Sena's request, you must organize medicines arranged in a row on a shelf. You want the medicines on the shelf to be of the same types as much as possible. Currently, the label on the -th medicine bears an uppercase letter , representing its type.
To organize the medicines, you may perform each of the following three operations as many times as you wish.
If an operation replaces some , subsequent operations use the updated value of .
You want to minimize the number of distinct types of medicine after organizing them. Find this minimum number and a final arrangement achieving it.
If there are multiple possible final arrangements, print any of them.