swift
Complexity\n- Time complexity:\nO(n)\n\n# Code\n\nclass Solution {\n    func divideString(_ s: String, _ k: Int, _ fill: Character) -> [String] {\n        //cal
# Complexity\n- Time complexity:\nO(n)\n\n# Code\n```\nclass Solution {\n    func divideString(_ s: String, _ k: Int, _ fill: Character) -> [String] {\n        //calculate new size of string\n        let resultCount = (s.count / k + (s.count % k > 0 ? 1 : 0)) * k\n            let sArr = Array(s)\n            var i = 0\n            var result = [String]()\n            var temp = ""\n            while i < resultCount {\n                let nextSymbol =  i >= sArr.count ? fill : sArr[i]                             \n                temp = temp + String(nextSymbol)\n                i += 1\n                if i % k  == 0 {\n                    result.append(temp)\n                    temp = ""\n                }\n            }\n            return result\n    }\n}\n```
['Swift']