#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "strbuf.h"



struct strbuf strbuf_new(void) {
    // TODO: implement this function
    struct strbuf buf = {NULL, 0, 0};
    return buf;
}

void strbuf_append(struct strbuf *buf, char *s) {
    // TODO: implement this function
    (void) buf;
    (void) s;
}

void strbuf_free(struct strbuf *buf) {
    // TODO: implement this function
    (void) buf;
}


int main(void) {
    struct strbuf buf = strbuf_new();
    int n;
    if (scanf("%d", &n) != 1) { n = 0; }
    int ch;
    while ((ch = getchar()) != '\n' && ch != EOF) { }
    for (int i = 0; i < n; i++) {
        char line[1000];
        if (fgets(line, sizeof line, stdin) == NULL) { break; }
        line[strcspn(line, "\n")] = '\0';
        strbuf_append(&buf, line);
    }
    printf("%s\n", buf.data == NULL ? "" : buf.data);
    printf("%d\n", buf.length);
    strbuf_free(&buf);
    return 0;
}
