Modified Binary Search to Avoid Problem
Explanation\n Describe your first thoughts on how to solve this problem. \nSince the length of the message that can be expressed as a function of the number of 
# Explanation\n<!-- Describe your first thoughts on how to solve this problem. -->\nSince the length of the message that can be expressed as a function of the number of suffix is not monotonic, it creates a trouble for using Binary search. (e.g. 100 suffix will likely be able to express a message shorter than 99 messages.)\n\nTo solve this problem, we just need to first find what is the least number of digits needed for the number of suffix. Then use this as the upper bound for the number of suffix in binary search. (set it as the r pointer at the beginning) \n\nThis should solve the problem with using Binary Search.\n\n# Code\n```python3 []\nclass Solution:\n    def splitMessage(self, message: str, limit: int) -> List[str]:\n            \n        def message_len(num_suffix):\n            num_suffix_str = str(int(num_suffix))\n            num_digits = len(num_suffix_str)\n            out = 0\n            for digit in range(num_digits):\n                num_message_char = limit - 3 - num_digits - digit-1\n                if num_message_char <= 0:\n                    return out\n                else:\n                    if digit != num_digits-1:\n                        out += num_message_char * 9 * 10**digit\n                    else: # last digit\n                        out += num_message_char * (num_suffix - (int("9"*(num_digits-1)) if num_digits>1 else 0))\n            return out\n\n        possible = False\n        for num_digits in range(1, 10):\n            if message_len(int("9"*num_digits)) >= len(message):\n                num_digits_ub = num_digits\n                possible = True\n                break\n        if not possible:\n            return []\n\n        # binary search, find least num_suffix\n        l,r = 1, int("9"*num_digits_ub)\n        while l<r:\n            mid = (l+r) // 2\n            if message_len(mid) >= len(message):\n                r = mid\n            else:\n                l = mid + 1\n    \n        out = []\n        i = 0 # ptr on the message string\n        num_digits = len(str(l))\n        for suffix_ind in range(1, l+1):\n            digits = len(str(suffix_ind))\n            num_message_char = limit - 3 - num_digits - digits\n            out.append(message[i:i+num_message_char] + "<"+str(suffix_ind)+"/"+str(l)+">")\n            i += num_message_char\n\n        return out\n\n\n\n\n\n\n\n\n\n```
['Python3']