-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBigSorting.cpp
More file actions
51 lines (34 loc) · 743 Bytes
/
BigSorting.cpp
File metadata and controls
51 lines (34 loc) · 743 Bytes
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// problem: "https://www.hackerrank.com/challenges/big-sorting/problem"
//#include<iostream>
//#include<string>
//#include<vector>
#include <bits/stdc++.h>
using namespace std;
bool myfunction(string s1,string s2)
{
int l1,l2;
l1=s1.length();
l2=s2.length();
if(l1==l2)
return (s1<s2);
else
return l1<l2;
}
int main()
{
int i,j,x,n;
string s;
//std::string::iterator it;
cin>>n;
vector<string>str(n);
for(i=0;i<n;i++)
{
cin>>str[i];
//str.push_back(s);
}
sort(str.begin(),str.end(),myfunction);
for(i=0;i<n;i++)
cout<<str[i]<<'\n';
//cout<<str[n-1];
return 0;
}