Company: Epam
Difficulty: medium
Workflow Replacement Count A company maintains a workflow configuration string config consisting of digits ('0'-'9') and placeholder characters ('?'). Each '?' can be replaced with any digit from 0 to 9. Your task is to determine the number of valid configurations that can be formed such that: No two adjacent characters in the final string are the same. All '?' placeholders are replaced with digits. Existing digits must remain unchanged. Note that if the given digits already place two equal digits next to each other, no valid configuration exists and the answer is 0. Since the number of possible configurations can be very large, return the answer modulo 10 9 + 7. Input Format A single line containing the string config . Output Format Print a single integer — the total number of valid configurations modulo 10 9 +7. Constraints 1 ≤ |config| ≤ 10 5 config consists only of digits from '0' to '9' and '?' placeholder characters. Sample Input 1 ?2 Sample Output 1 9 Explanation 1 T