欢迎来到起遇信息学
起遇信息学正处于上线筹建阶段,以下功能已全部开放免费体验: ✅ 完整题库浏览与代码提交评测(C / C++ / Python / Java 等) ✅ 入门到进阶的系列课程试读、作业与考试 ✅ AI 提示、AI 作业分析等智能助教功能 ✅ 赛事模拟与个人能力报告 ✅ 邮箱注册开放 ⏳ 付费课程订阅与微信/支付宝支付通道 ⏳ 手机号登录,微信扫码登录、微信公众号绑定 使用中如遇任何问题,欢迎通过页面底部 **"联系我们"** 与我们沟通。
CF1107A.Digits Sequence Dividing
Digits Sequence Dividing
You are given a sequence consisting of digits from to .
You have to divide it into at least two segments (segment — is a consecutive sequence of elements) (in other words, you have to place separators between some digits of the sequence) in such a way that each element belongs to exactly one segment and if the resulting division will be represented as an integer numbers sequence then each next element of this sequence will be strictly greater than the previous one.
More formally: if the resulting division of the sequence is , where is the number of element in a division, then for each from to the condition (using numerical comparing, it means that the integer representations of strings are compared) should be satisfied.
For example, if then you can divide it into parts and it will be suitable division. But if you will divide it into parts then it will be bad division because . If then you can divide it into parts , but not into parts .
Your task is to find any suitable division for each of the independent queries.
Input
The first line of the input contains one integer () — the number of queries.
The first line of the -th query contains one integer number () — the number of digits in the -th query.
The second line of the -th query contains one string of length consisting only of digits from to .
Output
If the sequence of digits in the -th query cannot be divided into at least two parts in a way described in the problem statement, print the single line "NO" for this query.
Otherwise in the first line of the answer to this query print "YES", on the second line print — the number of parts in your division of the -th query sequence and in the third line print strings — your division. Parts should be printed in order of the initial string digits. It means that if you write the parts one after another without changing their order then you'll get the string .
See examples for better understanding.
Samples
4
6
654321
4
1337
2
33
4
2122
YES
3
6 54 321
YES
3
1 3 37
NO
YES
2
21 22
在线编程 IDE
建议全屏模式获得最佳体验
| 进入全屏编程 | Alt+E |
| 递交评测 | Ctrl+Enter |
| 注释/取消注释 | Ctrl+/ |
| 缩放字体 | Ctrl+滚轮 |