dp based simple c++ solution||O(n)
\nclass Solution {\npublic:\n    int mod=1000000007;\n    int count(string &ss,int s,vector<int>&dp,map<char,int>&m)\n    {\n        if(s>=ss.length())\n       
```\nclass Solution {\npublic:\n    int mod=1000000007;\n    int count(string &ss,int s,vector<int>&dp,map<char,int>&m)\n    {\n        if(s>=ss.length())\n        {\n            return 1;\n        }\n        if(dp[s]!=-1)\n            return dp[s];\n        int ans=0;\n        char ch=ss[s];\n        int k=m[ch];\n        int j=s;\n        while(j<ss.length() and j-s<k and ss[j]==ss[s])\n        {\n            ans=(ans%mod+count(ss,j+1,dp,m)%mod)%mod;\n            j++;\n        }\n        dp[s]=ans;\n        return ans;\n    }\n    int countTexts(string s) {\n        int n=s.length();\n        vector<int>dp(n+1,-1);\n        map<char,int>m;\n        m[\'2\']=3;\n        m[\'3\']=3;\n        m[\'4\']=3;\n        m[\'5\']=3;\n        m[\'6\']=3;\n        m[\'7\']=4;\n        m[\'8\']=3;\n        m[\'9\']=4;\n        \n        return count(s,0,dp,m);\n        \n    }\n};\n```
['C']