forked from xperzy/careerup150
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path11-2.cpp
44 lines (31 loc) · 753 Bytes
/
11-2.cpp
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
#include <iostream>
#include <string>
#include <vector>
using namespace std;
bool myfunc(string a, string b){
sort(a.begin(),a.end());
sort(b.begin(),b.end());
return (a<b);
}
void sortArr(vector<string> &str_arr){
sort(str_arr.begin(),str_arr.end(),myfunc);
}
int main(){
vector<string> str_arr;
str_arr.push_back("bcdde");
str_arr.push_back("abcde");
str_arr.push_back("aaaaa");
str_arr.push_back("bcdec");
str_arr.push_back("adbce");
str_arr.push_back("bdcce");
str_arr.push_back("ccccc");
str_arr.push_back("aaacc");
str_arr.push_back("ddecb");
str_arr.push_back("ccaaa");
sortArr(str_arr);
for (int i=0;i<str_arr.size();i++){
cout << str_arr[i] <<" ";
}
cout <<endl;
return 0;
}