链接:https://ac.nowcoder.com/acm/contest/887/A
来源:牛客网
题目描述
A string is perfect if it has the smallest lexicographical ordering among its cyclic rotations.
For example: "0101" is perfect as it is the smallest string among ("0101", "1010", "0101", "1010").
Given a 01 string, you need to split it into the least parts and all parts are perfect.输入描述:
The first line of the input gives the number of test cases, T (T≤300)T\ (T \leq 300)T (T≤300). test cases follow. For each test case, the only line contains one non-empty 01 string. The length of string is not exceed 200.输出描述:
For each test case, output one string separated by a space.示例1
输入
复制
4 0 0001 0010 111011110输出
复制
0 0001
String 2019牛客暑期多校训练营(第七场)(最小表示法)
最新推荐文章于 2020-10-19 15:27:30 发布