Given adictionaryconsisting of manyrootsand asentenceconsisting of words separated by spaces, replace all the derivatives in the sentence with therootforming it. If a derivative can be replaced by more than one
48ms 1classSolution {2privatestructConfirmedReplacement {3let start: String.Index4let end: String.Index5let target: String6}78func findReplaceString(_ S: String, _ indexes: [Int], _ sources: [String], _ targets: [String]) ->String {9varconfirmedTargets: [ConfirmedReplacement] =[]10//1...
Given a dictionary consisting of many roots and a sentence consisting of words separated by spaces, replace all the successors in the sentence with the root forming it. If a successor can be replaced by more than one root, replace it with the root that has the shortest length. Return the ...