You are given a string s that you must perform k replacement operations on, along with three arrays of length k: indices, sources, and targets.
For each operation i:
Check if the substring in s starting at index indices[i] matches sources[i].
If it matches, replace that occurrence with targets[i].
If it does not match, do not perform any modification for this operation.
All replacement operations occur simultaneously on the original string s, meaning that replacements do not affect the index positions or text examined by other operations.
Return the resulting string after executing all valid replacement operations.
Constraints:
s.length
k indices.length sources.length targets.length
k
indices[i] s.length
sources[i].length, targets[i].length
s consists of only lowercase English letters.
sources[i] and targets[i] consist of only lowercase English letters.
You are given a string s that you must perform k replacement operations on, along with three arrays of length k: indices, sources, and targets.
For each operation i:
Check if the substring in s starting at index indices[i] matches sources[i].
If it matches, replace that occurrence with targets[i].
If it does not match, do not perform any modification for this operation.
All replacement operations occur simultaneously on the original string s, meaning that replacements do not affect the index positions or text examined by other operations.
Return the resulting string after executing all valid replacement operations.
Constraints:
s.length
k indices.length sources.length targets.length
k
indices[i] s.length
sources[i].length, targets[i].length
s consists of only lowercase English letters.
sources[i] and targets[i] consist of only lowercase English letters.