------
## 最终结论
```python
def findReplaceString(S, indexes, sources, targets):
    # Create a list of tuples with index, source and target
    replacements = sorted(zip(indexes, sources, targets), key=lambda x: x[0], reverse=True)
    
    # Iterate over the replacements in reverse order of indexes
    for i, source, target in replacements:
        # Check if the source matches the substring in S starting at index i
        if S[i:i+len(source)] == source:
            # Replace the substring with the target
            S = S[:i] + target + S[i+len(source):]
    
    return S

# Example usage:
S1 = "abcd"
indexes1 = [0, 2]
sources1 = ["a", "cd"]
targets1 = ["eee", "ffff"]
print(findReplaceString(S1, indexes1, sources1, targets1))  # Output: "eeebffff"

S2 = "abcd"
indexes2 = [0, 2]
sources2 = ["ab", "ec"]
targets2 = ["eee", "ffff"]
print(findReplaceString(S2, indexes2, sources2, targets2))  # Output: "eeecd"
```