[Python] Find the number of substrings
Explanation\nThe key question is to find out the number of split parts k.\n\ncur is the total string length of all indices,\nlike the string length for "123" is
# **Explanation**\nThe key question is to find out the number of split parts `k`.\n\n`cur` is the total string length of all indices,\nlike the string length for "123" is 3.\n`</>` takes 3 characters.\nThe number `k` takes `len(str(k))` characters.\n\nIf `cur + len(s) + (3 + len(str(k))) * k > limit * k`,\nmeans not enough characters to split `s`.\n\nIf `3 + len(str(k)) * 2 >= limit`,\n`k` means `<k/k>` already takes `limit` characters,\nit is impossible to split message as required.\n\nWe increment `k` from 0 until we find `k` that can split message `s` as required.\n<br>\n\n# **Complexity**\nTime `O(n)`\nSpace `O(n)`\n<br>\n\n**Python**\n```py\n    def splitMessage(self, s: str, limit: int) -> List[str]:\n        cur = k = i = 0\n        while 3 + len(str(k)) * 2 < limit and cur + len(s) + (3 + len(str(k))) * k > limit * k:\n            k += 1\n            cur += len(str(k))\n        res = []\n        if 3 + len(str(k)) * 2 < limit:\n            for j in range(1, k + 1):\n                l = limit - (len(str(j)) + 3 + len(str(k)))\n                res.append(\'%s<%s/%s>\' % (s[i:i + l], j, k))\n                i += l\n        return res\n```\n
['Python']