#include <stdlib.h>
#include <stdio.h>
#include <string.h>
int main() {
int size=0;
char str[]="Ola. Tudo bem?\n Sim e contigo?\n\n Comigo esta tudo bem! Que tens feito?\n Trabalho no projeto!\n";
int separadores = 0, i;
for (i=0; i < size; ++i){
if (str[i] == '\n'){
separadores++;
}
}
separadores++;
char **matriz
= malloc(sizeof(char*)*separadores
); int ultimo = 0, j=0;
for (i=0; i < size; ++i){
if (str[i] == '\n' || i == (size-1)){
if (i-ultimo > 1){
matriz
[j
] = malloc(sizeof(char)*(i
-ultimo
)); memcpy(matriz
[j
], str
+ultimo
, i
-ultimo
); matriz[j][i-ultimo]='\0';
j++;
}
ultimo=i+1;
}
}
for(i=0; i < j;++i){
}
return 0;
}
I2luY2x1ZGUgPHN0ZGxpYi5oPgojaW5jbHVkZSA8c3RkaW8uaD4KI2luY2x1ZGUgPHN0cmluZy5oPgoKaW50IG1haW4oKSB7CgoJaW50IHNpemU9MDsKCWNoYXIgc3RyW109Ik9sYS4gVHVkbyBiZW0/XG4gU2ltIGUgY29udGlnbz9cblxuIENvbWlnbyBlc3RhIHR1ZG8gYmVtISBRdWUgdGVucyBmZWl0bz9cbiBUcmFiYWxobyBubyBwcm9qZXRvIVxuIjsKCgoJc2l6ZSA9IHN0cmxlbihzdHIpOwoJcHJpbnRmKCIlZFxuIixzaXplKTsKCiAgICBpbnQgc2VwYXJhZG9yZXMgPSAwLCBpOwoKICAgIGZvciAoaT0wOyBpIDwgc2l6ZTsgKytpKXsKICAgICAgICBpZiAoc3RyW2ldID09ICdcbicpewogICAgICAgICAgICBzZXBhcmFkb3JlcysrOwogICAgICAgIH0KICAgIH0KCiAgICBzZXBhcmFkb3JlcysrOwoKICAgIGNoYXIgKiptYXRyaXogPSBtYWxsb2Moc2l6ZW9mKGNoYXIqKSpzZXBhcmFkb3Jlcyk7CiAgICBpbnQgdWx0aW1vID0gMCwgaj0wOwoKICAgIGZvciAoaT0wOyBpIDwgc2l6ZTsgKytpKXsKICAgICAgICBpZiAoc3RyW2ldID09ICdcbicgfHwgaSA9PSAoc2l6ZS0xKSl7CiAgICAgICAgICAgIGlmIChpLXVsdGltbyA+IDEpewogICAgICAgICAgICAgICAgbWF0cml6W2pdID0gbWFsbG9jKHNpemVvZihjaGFyKSooaS11bHRpbW8pKTsKICAgICAgICAgICAgICAgIG1lbWNweShtYXRyaXpbal0sIHN0cit1bHRpbW8sIGktdWx0aW1vKTsKICAgICAgICAgICAgICAgIG1hdHJpeltqXVtpLXVsdGltb109J1wwJzsKICAgICAgICAgICAgICAgIGorKzsKICAgICAgICAgICAgfQogICAgICAgICAgICB1bHRpbW89aSsxOwogICAgICAgIH0KICAgIH0KCgogICAgZm9yKGk9MDsgaSA8IGo7KytpKXsKICAgICAgICBwcmludGYoIiVzXG4iLG1hdHJpeltpXSk7CiAgICB9CgoJcmV0dXJuIDA7Cgp9Cg==