#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

// Node definition
typedef struct Node {
    char title[101];
    struct Node* next;
} Node;

// Function to check if title is valid (only letters + spaces)
int isValidTitle(char *str) {
    for (int i = 0; str[i] != '\0'; i++) {
        if (!(isalpha(str[i]) || str[i] == ' ')) {
            return 0; // invalid if not letter or space
        }
    }
    return 1;
}

// Function to create a new node
Node* createNode(char *title) {
    Node* newNode = (Node*)malloc(sizeof(Node));
    strcpy(newNode->title, title);
    newNode->next = NULL;
    return newNode;
}

// Function to insert at end
void insertEnd(Node** head, char *title) {
    Node* newNode = createNode(title);
    if (*head == NULL) {
        *head = newNode;
        return;
    }
    Node* temp = *head;
    while (temp->next != NULL)
        temp = temp->next;
    temp->next = newNode;
}

// Function to search book and return position
int searchBook(Node* head, char *searchTitle) {
    int pos = 1;
    Node* temp = head;
    while (temp != NULL) {