#d2743. 漂亮数
漂亮数
Beautiful Number
Problem Description
You are given a number of length , whose decimal digits are (ordered from left to right). You are also given an integer .
You need to construct the smallest number satisfying the following two conditions:
- For every position with , we have ;
- ,
where are the digits of from left to right.
Input Format
The first line contains two integers , where and .
The second line contains , written as a string of digits .
Output Format
The first line contains , the length of .
The second line contains the smallest valid number , written as the digits .
Sample Input
3 2
353
Sample Output
3
353