C++|O(N + T)|Easy Approach
Intuition\nGetting the length of the resultant string with using frequency of characters.\n\n# Approach\n1. Get the frequency of the input string in a map/array
# Intuition\nGetting the length of the resultant string with using frequency of characters.\n\n# Approach\n1. Get the frequency of the input string in a map/array.\n2. Now, we have to do t operations on that frequency map/array so that we can get the length of the resultant string.\n3. We know that a will be replace with b and b will be replaced with c but z will be replaced with a, b. So this condition we have to handle seperately.\n4. An arr temp integer array will store the frequencies of the characters after performing 1 of t operations with the help of the freq integer array.\n5. When we are encountering \'z\', and if the freq of z in that string is x, then we can directly add x to both \'a\' and \'b\'. \n6. Now temp array will hold the frequency of the characters of the transformed string.\n7. So copy the contents from arr to freq array.\n8. Continue the above operation till t becomes 0.\n9. Atlast, the freq integer array will hold frequencies of each character from a to z and thus summing up the frequencies will provide us the result.\n10. Return the result.\n\n# Complexity\n- Time complexity:\nO(N + T)\n\n- Space complexity:\nO(26) -> ~O(1)\n\n# Code\n```cpp []\nint mod = 1e9 + 7;\nclass Solution {\npublic:\n    int lengthAfterTransformations(string s, int t) {\n        int n = s.length();\n        int freq[26];\n        memset(freq, 0, sizeof(freq));\n        for(char &ch : s) {\n            freq[ch - \'a\']++;\n        }\n        while(t--) {\n            int arr[26];\n            memset(arr, 0, sizeof(arr));\n            for(int i = 0; i < 26; i++) {\n                int currCount = freq[i];\n                if(i == 25) {\n                    if(freq[25] != 0) {\n                        int count = freq[25];\n                        arr[0] = ((arr[0] + count) % mod);\n                        arr[1] = ((arr[1] + count) % mod);\n                    }\n                } else {\n                    arr[i + 1] = (freq[i] % mod);\n                }\n            }\n            memcpy(freq, arr, sizeof(freq));\n        }\n        int result = 0;\n        for(int i = 0; i < 26; i++) {\n            result = ((result + freq[i]) % mod);\n        }\n        return result;\n    }\n};\n\n/*\na   b   c   d   e   f   g   h   i   j   k   l   m   n   o   p   q   r   s   t   u   v   w   x   y   z\n1   1   1                                                                                       2\n\nt = 1(bcdzz)\n\na   b   c   d   e   f   g   h   i   j   k   l   m   n   o   p   q   r   s   t   u   v   w   x   y   z\n0   1   1   1                                                                                   0   2\n\nt = 2\na   b   c   d   e   f   g   h   i   j   k   l   m   n   o   p   q   r   s   t   u   v   w   x   y   z\n2   2   1   1   1                                                                                   0   \n*/\n```
['C++']