Easy Solution | Beats 100% Space
Intuition\nkeep track of all character count in each iterations\n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time complexi
# Intuition\nkeep track of all character count in each iterations\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```java []\nclass Solution {\n    long mod=(long)(int)1e9+7;\n    public int lengthAfterTransformations(String s, int t) {\n        long arr[]=new long[26];\n        long count=0;\n        for(char c:s.toCharArray()){\n            arr[c-\'a\']++;\n        }\n        for(int i=0;i<t;i++){\n            long tmp[]=new long[26];\n            for(int j=0;j<26;j++){\n                if(j==25) // \'z\'\n                {\n                    tmp[0]+=arr[25]%mod;\n                    tmp[1]+=arr[25]%mod;\n                }\n                else{\n                    tmp[j+1]=arr[j]%mod;\n                }\n            }\n            // System.out.println(Arrays.toString(tmp));\n            arr=tmp;\n        }\n        for(int i=0;i<arr.length;i++){\n            count+=arr[i];\n        } \n        return (int) (count%mod);\n\n    }\n}\n```
['Array', 'Java']