Coding · Hard · ProReplace words with roots from dictionaryCodingTrieStaffModel answerPreviewApproachClarify constraints and edge cases for: Replace words with roots from dictionary.Choose appropriate data structure; state…