C++ || EASY TO UNDERSTAND || SIMPLE || DP || Recursion + Memoization
\n#define ll long long int\nll mod=1e9+7;\nclass Solution {\npublic:\n    int solve(string &s,int i,int n,vector<int> &dp)\n    {\n        if(i>=n)\n        {\n
```\n#define ll long long int\nll mod=1e9+7;\nclass Solution {\npublic:\n    int solve(string &s,int i,int n,vector<int> &dp)\n    {\n        if(i>=n)\n        {\n            return 1;\n        }\n        if(dp[i]!=-1)\n        {\n            return dp[i];\n        }\n        ll ans=0;\n        if(i+1<n&&s[i]==s[i+1])\n        {\n            ans+=solve(s,i+2,n,dp)%mod;\n            if(i+2<n&&s[i]==s[i+2])\n            {\n                ans+=solve(s,i+3,n,dp)%mod;\n                if(i+3<n&&s[i]==s[i+3]&&(s[i]==\'9\'||s[i]==\'7\'))\n                {\n                    ans+=solve(s,i+4,n,dp)%mod;\n                }\n            }\n        }\n        ans=(ans%mod+solve(s,i+1,n,dp)%mod)%mod;\n        return dp[i]=ans%mod;\n    }\n    int countTexts(string s) {\n        int n=s.size();\n        vector<int> dp(n+1,-1);\n        return solve(s,0,n,dp);\n    }\n};\n```\n**Please upvote to motivate me in my quest of documenting all leetcode solutions(to help the community). HAPPY CODING:)\nAny suggestions and improvements are always welcome**
[]