| 17 | vector<string> st; |
| 18 | |
| 19 | int main() { |
| 20 | string c; |
| 21 | int numberOfTestCases;//number of test cases |
| 22 | cin >> numberOfTestCases; |
| 23 | for (int i = 0; i < numberOfTestCases; i++) { |
| 24 | string s; |
| 25 | cin >> s; |
| 26 | st.push_back(s); |
| 27 | } |
| 28 | for (int i = 0; i < numberOfTestCases; i++) { |
| 29 | string tmp = st[i]; |
| 30 | string answer; |
| 31 | do { |
| 32 | next_permutation(st[i].begin(), st[i].end()); // for sorting |
| 33 | if (tmp < st[i]) |
| 34 | answer = st[i]; |
| 35 | tmp = st[i]; |
| 36 | |
| 37 | } while (st[i] != tmp); |
| 38 | |
| 39 | if (answer.empty()) |
| 40 | cout << "no answer" << endl; |
| 41 | else |
| 42 | cout << answer << endl; |
| 43 | } |
| 44 | return 0; |
| 45 | } |
nothing calls this directly
no outgoing calls
no test coverage detected