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

typedef int bool;
enum { false, true };

// elemento da lista
typedef struct estr {
    char letra;
    struct estr *prox;
} NO;

typedef struct {
    NO *inicio;
} LISTA;

void inicializarLista(LISTA *l) {
    l->inicio = NULL;
}

void criarLista(LISTA *l, char plvr[]) {
    NO *ult = NULL;
    for (int i = 0; i < strlen(plvr); i++) {
        NO *novo = (NO *) malloc(sizeof(NO));
        novo->letra = plvr[i];
        novo->prox = NULL;
        if (ult) {
            ult->prox = novo;
        } else {
            l->inicio = novo;
        }
        ult = novo;
    }
}

void imprimirLista(LISTA l) {
    NO *p = l.inicio;
    while(p) {
        printf("%c", p->letra);
        p = p->prox;
    }
}

int main() {
    LISTA l;
    inicializarLista(&l);
    char palavra[] = "caio";
    //fgets(palavra, 3, stdin);
    criarLista(&l, palavra);
    imprimirLista(l);

    return 0;
}