Short Encoding of Words (LeetCode 820)The problem You want to encode a list of words as one string where each word is…