-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1181.cpp
More file actions
38 lines (28 loc) · 736 Bytes
/
1181.cpp
File metadata and controls
38 lines (28 loc) · 736 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
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
bool compare(string str1, string str2){
if(str1.size() == str2.size()) return str1 < str2;
return str1.size() < str2.size();
}
int main(void) {
ios_base::sync_with_stdio(false); cin.tie(NULL);
int n;
cin >> n;
vector<string> v;
vector<string>::iterator iter;
vector<string>::iterator end;
for(int i = 0 ; i<n; i++){
string str;
cin >> str;
v.push_back(str);
}
sort(v.begin(),v.end(),compare);
end = unique(v.begin(),v.end()); // 중복 제거
for(iter = v.begin(); iter != end; iter++){
cout << *iter << "\n";
}
return 0;
}