題目:
https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=448&page=show_problem&problem=4459
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| #include <bits/stdc++.h>
using namespace std;
int main(){ ios::sync_with_stdio(0); cin.tie(0);
int n; cin >> n >> ws; while(n--){ string text; getline(cin, text); string mini = text; text.append(text);
int half = text.length()/2; for(int i=1; i<half; ++i){ mini = min(mini, text.substr(i, half)); }
cout << mini << '\n'; } return 0; }
|