_ sources: [String], _ targets: [String]) ->String {3vardict: [Int: (String, String)] =Dictionary(uniqueKeysWithValues: zip(indexes, zip(sources, targets)) )4varindexes = indexes.sorted(by: >)5varS =Array(S)6va
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 oneroot, replace it with therootthat hasthe shortest length. Returnthesentenceafter the rep...
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 ...