秋招模拟赛第34场(会员专属)|2023.07.08-科大讯飞提前批
- Status
- Done
- Rule
- IOI
- Problem
- 3
- Start at
- 2023-7-20 19:00
- End at
- 2023-7-20 20:30
- Duration
- 1.5 hour(s)
- Host
- Partic.
- 17
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
塔子哥拿到了一个字符串,他希望通过切割操作将该字符串分割为完美字符串。完美字符串定义为长度大于等于2且首尾字符相同的串。
现在,塔子哥想知道,在进行切割操作后,他所能得到的最多完美字符串的数量是多少?
一个仅包含小写字母的字符串,长度不超过200000。
如果无法切割且字符串本身不是完美字符串,请输出−1。
否则输出最终的完美字符串数量。
输入输出示例仅供调试,后台数据一般不包含示例
输入
arcaea
输出
1
说明
本身即是完美字符串,且无法进行任何切制。
输入输出示例仅供调试,后台数据一般不包含示例
输入
abcb
输出
-1
说明
没有一种合法的切割方案。
扫码备注加群即可,期待您的到来~
By signing up a CodeFun2000 universal account, you can submit code and join discussions in all online judging services provided by us.