#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
bool compare(const string &a,const string &b)
{
if(a.length() != b.length()){
return a.length() < b.length();
}
else{
return a < b;
}
}
int main() {
int n;
cin >> n;
vector<string> zc;
int gg;
string pl;
for(int i = 0;i < n;i++){
cin >> pl;
zc.push_back(pl);
}
sort(zc.begin(),zc.end(), compare);
zc.erase(unique(zc.begin(), zc.end()),zc.end());
for (int i = 0;i < zc.size();i++ ) {
cout << zc[i]<< endl;
}
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: