// editor1
#include <stdio.h>
#include <string.h>
#include <ctype.h> 

#define
#define  

int isValidName(const char *name) {
    for (int i = 0; name[i] != '\0'; i++) {
        if (!isalnum(name[i]) && name[i] != ' ') {
            return 0; 
        }
    }
    return 1; 
}

int main() {
    int n;
    printf("Enter the number of visitors: ");
    scanf("%d", &n);

    if (n <= 0 || n > MAX_VISITORS) {
        printf("Invalid number of visitors.\n");
        return 1;
    }

    char visitorNames[MAX_VISITORS][MAX_NAME_LEN];

    while (getchar() != '\n'); 

    for (int i = 0; i < n; i++) {
        printf("Enter name for visitor %d: ", i + 1);
        fgets(visitorNames[i], MAX_NAME_LEN, stdin);
        visitorNames[i][strcspn(visitorNames[i], "\n")] = 0; 

        if (!isValidName(visitorNames[i])) {
            printf("Invalid input.\n");
            return 1; 
        }
    }

    printf("Visitor List: ");
    for (int i = 0; i < n; i++) {
        printf("%s", visitorNames[i]);
        if (i < n - 1) { 
            printf(" ");
        }
    }
    printf("\n"); 

    return 0;
}