Shortest & Easiest Brute - Force Approach ✅ ✅
Intuition :-\nThis isn\'t the complete brute - force approach but also not an optimized approach as we\'re using two "for loops" & one "nested for loop" which i
# Intuition :-\n*This isn\'t the complete brute - force approach but also not an optimized approach as we\'re using two "for loops" & one "nested for loop" which increases the time complexity by higher rate so it\'s a hybrid approach of brute - force & optimized.*\n\n# Approach :-\n*All we\'ve to do is to count the frequency of every character present inside the given string \'s\' and then to update them to given integer \'t\' transformations to get the final length of the string but keeping the size of the string small as possible or without creating a new string.*\n\n**The code is given below for further understanding \u270D\uFE0F(\u25D4\u25E1\u25D4)**\n\n# Code\n```cpp []\nclass Solution {\npublic:\n    int lengthAfterTransformations(string s, int t) {\n        long long ans = 0;\n        const int val = 1e9 + 7;\n        vector<long long> vec(26, 0);\n        for (auto i : s)\n            vec[i - \'a\']++;\n        for (int i = 0; i < t; i++) {\n            vector<long long> temp(26, 0);\n            for (int j = 0; j < 26; j++) {\n                if (j == 25) {\n                    temp[0] = (temp[0] + vec[j]) % val;\n                    temp[1] = (temp[1] + vec[j]) % val;\n                } else\n                    temp[j + 1] = (temp[j + 1] + vec[j]) % val;\n            }\n            vec = temp;\n        }\n        for (auto i : vec)\n            ans = (ans + i) % val;\n        return ans;\n    }\n};\n```\n\n# --- PLEASE UPVOTE ---\n![478xve.jpg](https://assets.leetcode.com/users/images/b6bd8170-cf1e-40f2-bbcb-76f4c9f2b22b_1730037951.9044762.jpeg)\n
['C++']