Time limit
2s
Memory limit
128 MB
A string represents an increasing list if every comma-separated item is a positive integer, no item starts with 0, and each number is strictly larger than the one before it.
You are given a string consisting only of digits, commas, and question marks. Replace each question mark with either one digit or one comma so that the resulting string is an increasing list. If several results are possible, print the lexicographically smallest one. In this lexicographic order, the comma , comes before the digits 0 through 9.
The first line contains a string made only of digits, commas, and question marks. Its length is at most 50.
Print the lexicographically smallest possible resulting string. If it is impossible, print -1.