Don't how i write but it worked 😅
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```cpp []\nclass Solution {\npublic:\n    // void f(int i,int j,int k2,int&n,int&m,bool &flag,string &s1, string& s2,bool &k,vector<bool>&ans,vector<int>&temp){\n    //     if(j>=m){\n    //         int k3=0;\n    //         for(int i=0;i<n;i++){\n    //             if(ans[i])temp[k3++]=i;\n    //         }\n    //         return;\n    //     }\n    //     if(i>=n|| i>temp[k2])return;\n    //     if(!flag){\n    //         while(i<=temp[k2] && i<n && j<m){\n    //             if(s1[i]==s2[j]){\n    //                 ans[i]=true;\n    //                 f(i+1,j+1,k2+1,n,m,flag,s1,s2,k,ans,temp);\n    //                 ans[i]=false;\n    //             }\n    //             i++;\n    //         }\n    //         return;\n    //     }\n    //     if(s1[i]==s2[j]){\n    //         ans[i]=true;\n    //         f(i+1,j+1,k2+1,n,m,flag,s1,s2,k,ans,temp);\n    //         ans[i]=false;\n    //     }\n    //     if(flag){\n    //         flag=false;\n    //         ans[i]=true;\n    //         f(i+1,j+1,k2+1,n,m,flag,s1,s2,k,ans,temp);\n    //         ans[i]=false;\n    //         flag=true;\n    //     }\n    //     if(temp[k2]<i)return;\n    //     f(i+1,j,k2,n,m,flag,s1,s2,k,ans,temp);\n    // }\n    vector<int> validSequence(string word1, string word2) {\n        int n=word1.size();\n        int m=word2.size();\n        vector<bool>ans(n,0);\n        vector<int>temp3(m);\n\n        int j=m-1;\n        vector<int>idx(m+1,-1);\n        idx[m]=n+1;\n        for(int i=n-1;i>=0&&j>=0;i--){\n            if(word1[i]==word2[j]){\n                idx[j]=i;\n                j--;\n            }\n        }\n        j=0;\n        for(int i=0;i<=n-m+j &&j<m;i++){\n            if(word1[i]==word2[j]){\n                ans[i]=true;\n                j++;\n            }else{\n                if(idx[j+1]<i+1)continue;\n                ans[i]=true;\n                i++;\n                j++;\n                while(i<n && j<m){\n                    if(word1[i]==word2[j]){\n                        ans[i]=true;\n                        j++;\n                    }\n                    i++;\n                }\n                int k=0;\n                for(int i=0;i<n&&k<m;i++){\n                    if(ans[i])temp3[k++]=i;\n                }\n                return temp3;\n            }\n\n        }\n        if(j<m)return {};\n        j=0;\n        for(int i=0;i<n&&j<m;i++){\n            if(ans[i])temp3[j++]=i;\n        }\n        return temp3;\n\n    }\n};\n```
['C++']