https://www.acmicpc.net/problem/1181
정렬 기준 만들어주기
⭐문자열 입출력
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
string a[20001];
bool compare(string a, string b) {
if(a.length() == b.length())
return a < b;
else
return a.length() < b.length();
}
int main(void) {
int number;
scanf("%d", &number);
for(int i=0; i<number; i++) {
cin >> a[i];
}
sort(a, a+number, compare);
for(int i=0; i<number; i++) {
if(i>0 && a[i] == a[i-1]) continue; // i>0 조건!!!
cout << a[i] << '\n';
}
return 0;
}