#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int ordena(const void * a, const void * b)
{
char **palavra1 = (char**) a;
char **palavra2 = (char**) b;
return strcmp(*palavra1
, *palavra2
); }
int main(int argc, char** argv)
{
char **nomes, frase[900], *ponteiro;
nomes
= malloc(sizeof(char*) * 3000); int indice, cont = 0, i;
for(indice = 0; indice < 3000; indice++)
{
nomes
[indice
] = malloc(sizeof(char) * 100); }
ponteiro
= strtok(frase
, " "); while(ponteiro != NULL)
{
strcpy(nomes
[cont
], ponteiro
); cont++;
}
qsort(nomes
, cont
, sizeof(nomes
[0]), ordena
); for(i = 0; i < cont; i++)
{
}
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KI2luY2x1ZGUgPHN0cmluZy5oPgoKaW50IG9yZGVuYShjb25zdCB2b2lkICogYSwgY29uc3Qgdm9pZCAqIGIpCnsKICAgIGNoYXIgKipwYWxhdnJhMSA9IChjaGFyKiopIGE7CiAgICBjaGFyICoqcGFsYXZyYTIgPSAoY2hhcioqKSBiOwogICAgcmV0dXJuIHN0cmNtcCgqcGFsYXZyYTEsICpwYWxhdnJhMik7Cn0KCmludCBtYWluKGludCBhcmdjLCBjaGFyKiogYXJndikKewogIGNoYXIgKipub21lcywgZnJhc2VbOTAwXSwgKnBvbnRlaXJvOwogIG5vbWVzID0gbWFsbG9jKHNpemVvZihjaGFyKikgKiAzMDAwKTsKICBpbnQgaW5kaWNlLCBjb250ID0gMCwgaTsKICBmb3IoaW5kaWNlID0gMDsgaW5kaWNlIDwgMzAwMDsgaW5kaWNlKyspCiAgewogICAgbm9tZXNbaW5kaWNlXSA9IG1hbGxvYyhzaXplb2YoY2hhcikgKiAxMDApOwogIH0KCiAgc2NhbmYoIiVbXlxuXSIsIGZyYXNlKTsKCiAgcG9udGVpcm8gPSBzdHJ0b2soZnJhc2UsICIgIik7CiAgd2hpbGUocG9udGVpcm8gIT0gTlVMTCkKICB7CiAgICAgc3RyY3B5KG5vbWVzW2NvbnRdLCBwb250ZWlybyk7CiAgICAgY29udCsrOwogICAgIHBvbnRlaXJvID0gc3RydG9rKE5VTEwsICIgIik7CiAgfQogIHFzb3J0KG5vbWVzLCBjb250LCBzaXplb2Yobm9tZXNbMF0pLCBvcmRlbmEpOwogIGZvcihpID0gMDsgaSA8IGNvbnQ7IGkrKykKICB7CiAgICBwcmludGYoIiVzXG4iLCBub21lc1tpXSk7CiAgfQoKICAgcmV0dXJuIDA7Cn0K