[Python3] greedy
Please pull this commit for solutions of biweekly 140. \n\n\nclass Solution:\n    def validSequence(self, word1: str, word2: str) -> List[int]:\n        n = len
Please pull this [commit](https://github.com/gaosanyong/leetcode/commit/b9fe03c491aa04ce243646bccf4b5ccab15f2d53) for solutions of biweekly 140. \n\n```\nclass Solution:\n    def validSequence(self, word1: str, word2: str) -> List[int]:\n        n = len(word2)\n        last = [-1]*n\n        j = n-1\n        for i, ch in reversed(list(enumerate(word1))): \n            if j >= 0 and ch == word2[j]: \n                last[j] = i \n                j -= 1\n        j = cnt = 0 \n        ans = []\n        for i, ch in enumerate(word1): \n            if j < n: \n                if ch == word2[j] or cnt == 0 and (j == n-1 or i+1 <= last[j+1]): \n                    if ch != word2[j]: cnt = 1\n                    ans.append(i)\n                    j += 1\n        return ans if j == n else []\n```
['Python3']