14. All numbers from 1 to 40 are written in a row. Without changing the order of writing, erase 60 digits so that the remaining digits express: a) the smallest number; b) the largest number.
14. a) In writing numbers from 1 to 40 inclusive, 71 digits are used. To make the remaining 11 digits express the smallest number, one must erase 60 larger digits, and in the remaining number, the smallest digits should be on the left. First, there are three zeros (remaining from the numbers 10, 20, 30). Then come 1, 2, 3, 3, 3, 3, 3, and 0. Therefore, the smallest number is $00012333330=12333330$. b) The largest number should start with the largest number of nines (there can be no more than three): these are the nines from the first three tens, the fourth digit should be the largest of those to the right of which there are still 7 digits. This digit is 6. Therefore, the largest number is 99967383940.