Showing items from replace words leetcode problem