#include
#include
using namespace std;
int main()
{
int T;
cin >> T;
while (T-- > 0)
{
string org;
cin >> org;
int n = org.size();
string smallest = org;
for (int i = 1; i < n; ++i)
{
string temp(&org[i], &org[n - 1] + 1);
temp.append(&org[0], &org[i]);
if (smallest > temp)
smallest = temp;
}
cout << smallest << endl;
}
}
相关文章:
- 题解 P4331 【[BalticOI 2004]Sequence 数字序列】 2022-12-23
- UVa 1584 - Circular Sequence 2021-06-09
- [LeetCode] Design Circular Queue 设计环形队列 2021-10-08
- 例题3-6 环状序列 2021-06-03
- 例题 3-6 环状序列 2022-12-23
- 2018 ACM ICPC Asia Regional - Seoul B.Cosmetic Survey 2021-05-19
- 2018 ACM ICPC Asia Regional - Seoul A. Circuits 2022-01-03
- 2020-2021 ACM-ICPC, Asia Seoul Regional Contest 2022-12-23