Workflow Replacement Count

Company: Epam

Difficulty: medium

Problem Statement

Workflow Replacement Count Problem Description A company maintains a workflow configuration string config made of digits ( '0' to '9' ) and placeholder characters ( '?' ). Each '?' can be replaced with any digit from 0 to 9 . Count the number of valid configurations that can be formed such that: no two adjacent characters of the final string are the same, every '?' is replaced with a digit, and the digits already present stay unchanged. If two equal digits are already next to each other in config , no valid configuration exists and the answer is 0 . A string without any '?' has exactly one configuration (itself), which is valid when no two adjacent digits are equal. Since the number of configurations can be very large, return it modulo 10^9 + 7 . Function Description Complete the function getWorkflowReplacements in the editor. It takes the following parameter and returns the number of valid configurations modulo 10^9 + 7 : config : the configuration string Input Format A single line co