C++ DP Solution
\'\'\'\n\n    int countTexts(string pressedKeys) {\n        int n = pressedKeys.length();\n        vector dp(n+1);\n        dp[0]=1;\n        int cnt;\n        
\'\'\'\n\n    int countTexts(string pressedKeys) {\n        int n = pressedKeys.length();\n        vector<long long> dp(n+1);\n        dp[0]=1;\n        int cnt;\n        for(int i=0;i<pressedKeys.size();i++)\n        {\n            int j=i;\n            if(pressedKeys[i]==\'7\' || pressedKeys[i]==\'9\')\n            {\n                cnt=4;\n            }\n            else\n            {\n                cnt=3;\n            }\n            while(j>=0 && cnt>0 && pressedKeys[j]==pressedKeys[i])\n            {\n                dp[i+1] = (dp[i+1] + dp[j])%1000000007;\n                j--;\n                cnt--;\n            }\n        }\n        \n        return dp[n];    \n    }\n\n\'\'\'
['Dynamic Programming', 'C']