中级农民
- 积分
- 106
- 大米
- 颗
- 鳄梨
- 个
- 水井
- 尺
- 蓝莓
- 颗
- 萝卜
- 根
- 小米
- 粒
- 学分
- 个
- 注册时间
- 2019-2-19
- 最后登录
- 1970-1-1
|
找到原题了:. check 1point3acres for more.
Split a string into sub-strings. Each sub-string should be no longer than the given limit. The input string contains English letters and spaces only.
Do not break a word into two sub strings. Remove all spaces in the beginning or end of every sub string.
. 1point 3acres
Extend: append notation such as " (1 of 12)" and strings are not longer than the limit even after the notation.
Length limit: 39. Input: The quick brown fox jumps over a lazy dogThe quick brown fox jumps over a lazy dogThe quick brown fox jumps over a lazy dogThe quick brown fox jumps over a lazy dogThe quick brown fox jumps over a lazy dogThe quick brown fox jumps over a lazy dogThe quick brown fox jumps over a lazy dogThe quick brown fox jumps over a lazy dogThe quick brown fox jumps over a lazy dog
Result should be:. .и
The quick brown fox jumps (1 of 14)
over a lazy dogThe quick (2 of 14)
. .иbrown fox jumps over a lazy (3 of 14)
dogThe quick brown fox jumps (4 of 14). 1point 3acres
over a lazy dogThe quick (5 of 14)
.. brown fox jumps over a lazy (6 of 14)
dogThe quick brown fox jumps (7 of 14)
over a lazy dogThe quick (8 of 14)
brown fox jumps over a lazy (9 of 14)
dogThe quick brown fox jumps (10 of 14)
over a lazy dogThe quick (11 of 14)
brown fox jumps over a lazy (12 of 14)
dogThe quick brown fox jumps (13 of 14).--
over a lazy dog (14 of 14)
应该还是我的那个思路,凑单词数,只要长度符合小于limit K就可以了 |
|