You are given two strings source and target of equal length, consisting of lowercase English letters.
You are also given a rules, where rules[i] = [pattern_i, replacement_i], and an integer array costs of equal length, where costs[i] denotes the base cost of applying rules[i].
In a single operation, you can choose a substring of source that matches pattern_i and replace it with replacement_i. A substring matches pattern_i if they have the same length and for every index, the character in pattern_i is either identical to the corresponding character in the substring or is the wildcard character '*'. Each wildcard character '*' matches any single lowercase English letter.
The total cost of applying rules[i] is costs[i] plus the number of '*' characters in pattern_i.
You can apply operations to any number of disjoint substrings of source. Any character in source that is not modified must already be identical to the character at the corresponding index in target with a cost of
Return the minimum total cost to transform source into target, or
Constraints:
source.length target.length
source and target consist of lowercase English letters.
rules.length costs.length
rules[i] = [pattern_i, replacement_i]
pattern_i.length replacement_i.length
pattern_i contains at least one lowercase English letter and at most '*' characters.
replacement_i contains only lowercase English letters.
costs[i]
You are given two strings source and target of equal length, consisting of lowercase English letters.
You are also given a rules, where rules[i] = [pattern_i, replacement_i], and an integer array costs of equal length, where costs[i] denotes the base cost of applying rules[i].
In a single operation, you can choose a substring of source that matches pattern_i and replace it with replacement_i. A substring matches pattern_i if they have the same length and for every index, the character in pattern_i is either identical to the corresponding character in the substring or is the wildcard character '*'. Each wildcard character '*' matches any single lowercase English letter.
The total cost of applying rules[i] is costs[i] plus the number of '*' characters in pattern_i.
You can apply operations to any number of disjoint substrings of source. Any character in source that is not modified must already be identical to the character at the corresponding index in target with a cost of
Return the minimum total cost to transform source into target, or
Constraints:
source.length target.length
source and target consist of lowercase English letters.
rules.length costs.length
rules[i] = [pattern_i, replacement_i]
pattern_i.length replacement_i.length
pattern_i contains at least one lowercase English letter and at most '*' characters.
replacement_i contains only lowercase English letters.
costs[i]