blob: 442f08e134c95ae28ccfe24c1793148e4f2fecf8 (
plain)
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
|
#include <AK/String.h>
#include <AK/QuickSort.h>
#include <AK/Vector.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char** argv)
{
UNUSED_PARAM(argc);
UNUSED_PARAM(argv);
Vector<String> lines;
for (;;) {
char buffer[BUFSIZ];
auto* str = fgets(buffer, sizeof(buffer), stdin);
if (!str)
break;
lines.append(buffer);
}
quick_sort(lines.begin(), lines.end(), [](auto& a, auto& b) {
return strcmp(a.characters(), b.characters()) < 0;
});
for (auto& line : lines) {
fputs(line.characters(), stdout);
}
return 0;
}
|