#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";


	size = strlen(str);
	printf("%d\n",size);

    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){
        printf("%s\n",matriz[i]);
    }

	return 0;

}
