标签:put code open max input int stdin include clu
#include<bits/stdc++.h>
using namespace std;
#define maxn 110
int solve(const char* s,int p,int q){
int n=strlen(s);
for(int i=0;i<n;i++)
if(s[(p+i)%n]!=s[(q+i)%n])
return s[(p+i)%n]<s[(q+i)%n];
return 0;
}
int main(){
int t;
char s[maxn];
//freopen("input.txt","r",stdin);
cin>>t;
while(t--){
cin>>s;
int ans=0;
int n=strlen(s);
for(int i=1;i<n;i++)
if(solve(s,i,ans)) ans=i;
for(int i=0;i<n;i++)
putchar(s[(i+ans)%n]);
cout<<endl;
}
return 0;
}
标签:put code open max input int stdin include clu
原文地址:https://www.cnblogs.com/mch5201314/p/9391706.html