Using counting

```java []
class Solution {
    public int lengthAfterTransformations(String s, int t) {
        int[]f=new int[26];
        for(char ch:s.toCharArray()){
            f[ch-'a']++;
        }
        for(int i=0;i<t;i++){
            int[]ft=new int[26];
            for(int j=0;j<26;j++){
                if(j<25){
                 ft[j+1]=f[j];                   
                }
                else{
                  ft[0]=f[j];
                  ft[1]+=f[j];
                  ft[1]%=1000000007;
                }
            }
            f=ft;
        }
        int ans=0;
        for(int i:f){
            ans+=i;
            ans%=1000000007;
        }
        return ans;
    }
}
```
['Java']