This commit is contained in:
mallowday 2024-01-31 17:15:04 +09:00
parent 54b3348c1a
commit 487ec71873

34
abc042/b.c Normal file
View file

@ -0,0 +1,34 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int compare_strings(const void *string1, const void *string2);
int main(void)
{
int i;
int number_strings;
int string_length;
char strings[100][100 + 1];
scanf("%d %d", &number_strings, &string_length);
i = 0;
while (i < number_strings)
{
scanf("%s", strings[i]);
++i;
}
qsort(strings, number_strings, sizeof(strings[0]), compare_strings);
i = 0;
while (i < number_strings)
{
printf("%s", strings[i]);
++i;
}
puts("");
}
int compare_strings(const void *string1, const void *string2)
{
return (strcmp(string1, string2));
}