c++ solution
\nclass Solution {\npublic:\n    const int mod=1e9+7;\n    int lengthAfterTransformations(string s, int t) {\n        vector<long long>prev(26,0);\n        for(
```\nclass Solution {\npublic:\n    const int mod=1e9+7;\n    int lengthAfterTransformations(string s, int t) {\n        vector<long long>prev(26,0);\n        for(auto &ch:s) prev[ch-\'a\']++;\n        while(t--){\n            vector<long long>curr(26,0);\n            for(int i=0;i<26;i++){\n                if(i==25){\n                    curr[0]=(curr[0]+prev[25])%mod;\n                    curr[1]=(curr[1]+prev[25])%mod;\n                }\n                else{\n                    curr[i+1]=(curr[i+1]+prev[i])%mod;\n                }\n            }\n            swap(curr,prev);\n        }\n        int result=0;\n        for(auto &it:prev){\n            result+=it;\n            result%=mod;\n        }\n        return result;\n    }\n};\n```
['C', 'C++']