[Java/C++/Python] DP
Intuition\nTransform characters a,b,c.. to 0,1,2.. first.\n\n# Explanation\ndp[i] is the length of character a transformed i times\n\nif i >= 26\ndp[i] = (dp[i 
# **Intuition**\nTransform characters `a,b,c..` to `0,1,2..` first.\n\n# **Explanation**\n`dp[i]` is the length of character `a` transformed `i` times\n\nif `i >= 26`\n`dp[i] = (dp[i - 26] + dp[i - 26 + 1]) % mod`\n\n# **Complexity**\nInit\nTime `O(t)`\nSpace `O(t)`\n\nsolution\nTime `O(n)`\nSpace `O(1)`\n\n```java\n    private int mod = 1000000007;\n    private int[] dp = new int[100100];\n\n    public Solution() {\n        for (int i = 0; i < 26; ++i)\n            dp[i] = 1;\n        for (int i = 26; i < 100100; ++i)\n            dp[i] = (dp[i - 26] + dp[i - 26 + 1]) % mod;\n    }\n\n    public int lengthAfterTransformations(String s, int t) {\n        int res = 0, n = s.length();\n        for (int i = 0; i < n; ++i)\n            res = (res + dp[s.charAt(i) - \'a\' + t]) % mod;\n        return res;\n    }\n```\n\n```C++ [C++]\n    int mod = 1e9 + 7, dp[100100];\n    Solution() {\n        for (int i = 0; i < 26; ++i)\n            dp[i] = 1;\n        for (int i = 26; i < 100100; ++i)\n            dp[i] = (dp[i - 26] + dp[i - 26 + 1]) % mod;\n    }\n\n    int lengthAfterTransformations(string s, int t) {\n        int res = 0;\n        for (char c : s) {\n            res = (res + dp[c - \'a\' + t]) % mod;\n        }\n        return res;\n    }\n```\n\n```py [Python3]\nmod = 10 ** 9 + 7\ndp = [1] * 26 + [0] * 100100\nfor i in range(26, 100100):\n    dp[i] = (dp[i - 26] + dp[i - 26 + 1]) % mod\n\nclass Solution:\n    def lengthAfterTransformations(self, s: str, t: int) -> int:\n        return sum(dp[ord(c) - ord(\'a\') + t] for c in s) % mod\n```\n\n# **More**\nAlso check `O(log(t))` solution [here](https://leetcode.com/problems/total-characters-in-string-after-transformations-ii/solutions/5972988/Python-Fast-Pow-O(log(t))/)\n
['C', 'Python', 'Java']