Problem | Verdict | Lang | Time | Best | Rank | Submit Time |
---|---|---|---|---|---|---|
| discuss1584 - | Accepted | C++11 | 0.070 | 0.000 | 3427 | 1 mins ago |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t; cin >> t;
while(t--){
string s; cin >> s;
set<string> myset;
for(int k=s.size()-1; k>=0; k--){
string ss="";
for(int i=k; i>=0; i--)
ss = s[i] + ss;
for(int i=s.size()-1; i>=k+1; i--)
ss = s[i] + ss;
myset.insert(ss);
}
cout<<*myset.begin()<<"\n";
}
}