DP - Top down Approach || JAVA || O(26*t)
Code


# Code
```java []
class Solution {
    int[][] dp;
    int mod = 1_000_000_007;
    public int lengthAfterTransformations(String s, int t) {
        int l = 0;
        dp = new int[27][t+1];
        for(int i=0; i<s.length(); i++){
            l += len(s.charAt(i)-'a', t);
            l%=mod;
        }
        return l;
    }

    int len(int c, int t){
        if(dp[c][t]!=0) return dp[c][t];
        int d = 26-c;
        if(d>t) return 1;
        return dp[c][t] = (len(0, t-d) + len(1, t-d))%mod;
    }
}
```
['Java']