mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
28 lines
582 B
C++
28 lines
582 B
C++
#include <AK/QuickSort.h>
|
|
#include <AK/Vector.h>
|
|
#include <AK/AKString.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
int main(int argc, char** 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;
|
|
}
|