fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. bool cmp(string a,string b)
  4. {
  5. return a+b>b+a;
  6. }
  7. main()
  8. {
  9. int n;cin>>n;
  10. string a;
  11. string str[1001] ; int dem=0;
  12. for(int i=0;i<n;i++)
  13. {
  14. cin>>a;
  15. str[dem]=a; dem++;
  16. }
  17. sort(str,str+dem,cmp);
  18. for(int i=0;i<dem;i++) cout<<str[i];
  19. }
Success #stdin #stdout 0.01s 5456KB
stdin
Standard input is empty
stdout
Standard output is empty