Simple intuition
Code
# Code
```java []
import java.util.Arrays;

public class Solution {
    public static int lengthAfterTransformations(String s, int t) {
        long ans = 0;
        long mod = 1000000007;
        long[] res = new long[26];
        for (int i = 0; i < s.length(); i++) {
            res[s.charAt(i) - 'a']++;
        }
        while (t > 0) {
            long count = res[25]; 
            for (int i = 24; i >= 0; i--) {
                res[i + 1] = res[i];
                res[i]=0;
            }
            res[0] += count;
            res[0] %= mod;
            res[1] += count;
            res[1] %= mod;
            t--;
        }
        for (long el : res) {
            ans = (ans + el) % mod;
        }
        return (int)(ans);
    }
}

```
['Java']