python dp top down super easy to understand
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```\nclass Solution:\n    def countTexts(self, pressedKeys: str) -> int:\n      \n        s = pressedKeys  \n        @functools.lru_cache\n        def dp(i):\n          if i == len(s):\n            return 1\n\n          prev = ""\n          ans = 0\n          for j in range(i, min(i+4,len(s))):\n            if not prev or prev == s[j]:\n                if s[j] in"234568":\n                  if j-i < 3:\n                    ans += dp(j+1)\n                else:\n                    ans += dp(j+1)\n            else:\n                break\n            prev = s[j]    \n          return ans\n        \n        return dp(0) % (10**9 + 7)\n\n\n\n```
['Dynamic Programming', 'Python3']