Solving Replace Words in go. Please try yourself first to solve the problem and submit your implementation to LeetCode before looking into solution.

Problem Description

You need to output the sentence after the replacement.

Example 1:

Input: dict = ["cat", "bat", "rat"]
sentence = "the cattle was rattled by the battery"
Output: "the cat was rat by the bat"

Note:

  1. The input will only have lower-case letters.
  2. 1 <= dict words number <= 1000
  3. 1 <= sentence words number <= 1000
  4. 1 <= root length <= 100
  5. 1 <= sentence words length <= 1000

See the full details of the problem Replace Words at LeetCode

Originally posted at: @github.com/halfrost/LeetCode-Go