Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main() {
- /* Enter your code here. Read input from STDIN. Print output to STDOUT */
- int Q;
- cin >> Q;
- while(Q--){
- int n;
- cin >> n;
- vector<string> input(n);
- for(int i=0; i<n; i++) cin >> input[i];
- auto lambda = [](string a, string b){
- return a + b > b + a;
- };
- sort(input.begin(), input.end(), lambda);
- string ans = "";
- for(auto el : input) ans += el;
- cout << ans << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment