A stamp turns a positive number into a number of the same length in which every digit equals the largest digit of the original. For example, 407 becomes 777, and 1000 becomes 1111.
You get an array of positive integers codes. Stamp each number and return the sum of the results.
Example 1
codes=[407, 58, 3] → 868
407 → 777, 58 → 88, 3 → 3; the total is 777 + 88 + 3 = 868.