Memo dp easy to understand
intution->we have to count how much combinations are possible from a number\neg abc->2,22,222\nif (2222)->not valid;break\n\n\nclass Solution {\npublic:\n    \n
intution->we have to count how much combinations are possible from a number\neg abc->2,22,222\nif (2222)->not valid;break\n\n```\nclass Solution {\npublic:\n    \n    \n    int mod = 1000000007;\n    map<int,int> index;\n    vector<string>mp{"", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"};\n    map<int,int> dp;\n    int solve(string &s, int i){\n        if (i>=s.size()){\n            return 1;\n        }\n        if (dp.find(i)!=dp.end()){\n            return dp[i];\n        }\n        int ways= 0;\n        int sz = index[s[i]-\'0\'];\n        int count = 0;\n        for (int j =i; j<s.size(); j++){\n            count++;\n            if (s[i]==s[j] && count<=sz){\n                ways+=solve(s,j+1);\n            }\n            else{\n                break;\n            }\n            \n            ways%=mod;\n        }\n         return dp[i] = ways%mod;\n        \n    }\n    int countTexts(string s) {\n        int count = 0;\n        for (auto it:mp){\n            string temp = it;\n            count++;\n            for (int i =0; i<temp.size(); i++){\n                index[count] = temp.size();\n            }\n        }\n        \n        return solve(s,0);\n        \n        \n    }\n};\n```\n
['Memoization']