#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef struct Node {
    char data[101];
    struct Node* next;
} Node;

// Create new node
Node* createNode(char* str) {
    Node* newNode = (Node*)malloc(sizeof(Node));
    strcpy(newNode->data, str);
    newNode->next = NULL;
    return newNode;
}

// Insert node at the end
void insertEnd(Node** head, char* str) {
    Node* newNode = createNode(str);
    if (*head == NULL) {
        *head = newNode;
        newNode->next = *head;
        return;
    }
    Node* temp = *head;
    while (temp->next != *head) {
        temp = temp->next;
    }
    temp->next = newNode;
    newNode->next = *head;
}

// Display circular linked list
void display(Node* head) {
    if (head == NULL) return;
    Node* temp = head;
    do {
        printf("%s ", temp->data);
        temp = temp->next;
    } while (temp != head);
}

// Insert new string at middle
void insertMiddle(Node** head, char* str, int n) {
    int mid = n / 2;  // middle index
    Node* newNode = createNode(str);

    if (*head == NULL) {
        *head = newNode;
        newNode->next = *head;
        
    }
}