diff --git a/3335. Total Characters in String After Transformations I b/3335. Total Characters in String After Transformations I new file mode 100644 index 0000000..adecd09 --- /dev/null +++ b/3335. Total Characters in String After Transformations I @@ -0,0 +1,26 @@ +class Solution { +public: + int mod=1e9+7; + int lengthAfterTransformations(string s, int t) { + vectorcnt(26,0); + for(char ch:s)cnt[ch-'a']++; + while(t--){ + vectorupdated(26,0); + for(int i=0;i<26;i++){ + if(i==25){ + updated[0]=(updated[0]+cnt[i])%mod; + updated[1]=(updated[1]+cnt[i])%mod; + } + else{ + updated[i+1]=(updated[i+1]+cnt[i])%mod; + } + } + cnt=updated; + } + long long ans=0; + for(auto c:cnt){ + ans=(ans+c)%mod; + } + return (int)ans; + } +};