-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1189.cpp
39 lines (38 loc) · 799 Bytes
/
1189.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
#include <stdio.h>
#include <string.h>
#include <string>
#include <stdlib.h>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <deque>
#pragma warning(disable:4996)
#define _CRT_SECURE_NO_WARNINGS
using namespace std;
bool check(const string &s1, const string &s2) {
if (s1.size() == s2.size()) {
return s1 < s2;
}
return s1.size() < s2.size();
}
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
vector<string> pu;
int n;
cin >> n;
for (int i = 0; i < n; i++) {
string a;
cin >> a;
pu.push_back(a);
}
sort(pu.begin(), pu.end(), check);
vector<string>::iterator iter;
vector<string>::iterator uni;
uni = unique(pu.begin(), pu.end());
for (iter = pu.begin(); iter != uni; iter++) {
printf("%s\n", (*iter).c_str());
}
return 0;
}