C++ Easy Understanding
Intution:-\n Maintain a partition string which represents each group in the string\n If the index i+1 is divisible by k then we can conclude that group is ended
**Intution:-**\n* Maintain a `partition` string which represents each group in the string\n* If the index `i+1` is divisible by `k` then we can conclude that group is ended with this `i` th index\n* Push the `partition` into the `ans` vector if group ends\n* Check whether last group has size `k` or not\n* If it is not equal then add `k - (len+1)` sized `fill` string to `partition`\n\n```\nclass Solution {\npublic:\n    vector<string> divideString(string s, int k, char fill) {\n        string partition="";\n        vector<string> ans;\n        int n=s.size();\n        for(int i=0;i<n;i++) {\n            partition.push_back(s[i]);\n            if(((i+1)%k)==0) {\n                ans.push_back(partition);\n                partition="";\n            }\n        }\n        // If last group doesn\'t have enough characters then add fill char to it\n        if(partition!="") {\n            int len=partition.size();\n            for(int i=len+1;i<=k;i++) {\n                partition.push_back(fill);\n            }\n            ans.push_back(partition);\n        }\n        return ans;\n    }\n};\n```\n**Time Complexity** - O(N) \n**Space Complexity** - O(N)
['String', 'C']