Easy Explained || Solution in C++
Approach\n Describe your approach to solving the problem. \nMake a counter of size 26.\nFor very tranformation\ndo counter[char] = counter[char-1]\nif char == \
# Approach\n<!-- Describe your approach to solving the problem. -->\nMake a counter of size 26.\nFor very tranformation\ndo `counter[char] = counter[char-1]`\n`if char == \'z\'` then replace "z" with "ab" i.e. `counter[\'a\'] += counter[\'z\'] and counter[\'b\'] += counter[\'z\']`\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n$$O(t)$$\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n$$O(1)$$\n\n# Code\n```cpp []\nclass Solution {\npublic:\n    int lengthAfterTransformations(string s, int t) {\n        const int MOD = 1e9 + 7;\n        int count[26] = {0};\n\n        for (char c : s) {\n            count[c - \'a\']++;\n        }\n\n        while (t > 0) {\n            int newCount[26] = {0};\n\n            newCount[0] = (newCount[0] + count[25]) % MOD;\n            newCount[1] = (newCount[1] + count[25]) % MOD;\n            for (int i = 0; i < 25; ++i) {\n                newCount[i + 1] = (newCount[i + 1] + count[i]) % MOD;\n            }\n            for (int i = 0; i < 26; ++i) {\n                count[i] = newCount[i];\n            }\n\n            t--;\n        }\n\n        int ans = 0;\n        for (int i = 0; i < 26; ++i) {\n            ans = (ans + count[i]) % MOD;\n        }\n\n        return ans;\n    }\n};\n```
['C++']