Golang 87 ms 7.3 MB
\nfunc max(a, b int) int {\n\tif a >= b {\n\t\treturn a\n\t}\n\treturn b\n}\n\nfunc splitMessage(message string, limit int) []string {\n\tfor totalDigitCount :=
```\nfunc max(a, b int) int {\n\tif a >= b {\n\t\treturn a\n\t}\n\treturn b\n}\n\nfunc splitMessage(message string, limit int) []string {\n\tfor totalDigitCount := 1; totalDigitCount < 5; totalDigitCount++ {\n\t\tprevMaxPayload, maxPayload := 0, 0\n\t\tmultiplier := 1\n\t\tfor curDigitCount := 1; curDigitCount <= totalDigitCount; curDigitCount, multiplier = curDigitCount+1, multiplier*10 {\n\t\t\tprevMaxPayload = maxPayload\n\t\t\tmaxPayload += max(0, (limit-3-totalDigitCount-curDigitCount)*9*multiplier)\n\t\t}\n\t\tif maxPayload < len(message) {\n\t\t\tcontinue\n\t\t}\n\t\tlastPartsLen := limit - 3 - totalDigitCount*2\n\t\ttotalPartsCount := multiplier/10 - 1 + (len(message)-prevMaxPayload+lastPartsLen-1)/lastPartsLen\n\t\ttotalPartsCountSuffix := "/" + strconv.Itoa(totalPartsCount) + ">"\n\t\tresult := make([]string, totalPartsCount)\n\t\tcIdx := 0\n\t\tfor i := 1; i < totalPartsCount; i++ {\n\t\t\tsuffix := "<" + strconv.Itoa(i) + totalPartsCountSuffix\n\t\t\tcIdx2 := limit - len(suffix) + cIdx\n\t\t\tresult[i-1] = message[cIdx:cIdx2] + suffix\n\t\t\tcIdx = cIdx2\n\t\t}\n\t\tresult[len(result)-1] = message[cIdx:] + "<" + strconv.Itoa(totalPartsCount) + totalPartsCountSuffix\n\t\treturn result\n\t}\n\treturn nil\n}\n```
['Go']