Easy to understand!
Intuition\nAt each transformation, transfer the no of characters at index i to index i+1. At beginning of each iteration store the frequency of \'z\' so that we
# Intuition\nAt each transformation, transfer the no of characters at index i to index i+1. At beginning of each iteration store the frequency of \'z\' so that we can add same no of \'a\' and \'b\'. This is because the string might contain a and z together. For eg string is "az".\nHere \'a\' will be converted to \'b\' and \'z\' will be converted to \'a\' and \'b\'. Therefore count of \'b\' increases.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\nO(N)\n\n- Space complexity:\nO(1). Consdering the vector which is of size 26.\n\n# Code\n```cpp []\nclass Solution {\npublic:\nint M=1e9+7;\n    int lengthAfterTransformations(string s, int t) {\n        vector<int> hm(26);\n        for(auto c:s) hm[c-\'a\']++;\n        while(t--){\n            int z=hm[25];\n            for(int i=24;i>=0;i--){\n                hm[i+1]=hm[i];\n                hm[i]=0;\n            }\n            // hm[25]= ((hm[25])%M-(z)%M)%M;\n            hm[0]=((hm[0])%M+(z)%M)%M;\n            hm[1]=((hm[1])%M+(z)%M)%M;\n        }\n        int ans=0;\n        for(auto x:hm) ans= ((ans)%M + (x)%M)%M;\n        return ans;\n    }\n};\n/*\nabcyy\n*/\n```
['C++']