#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdbool.h>

#define MAX 100005

bool isValidTag(const char *tag) {
    int len = strlen(tag);
    if (len < 3) return false;
    if (tag[0] != '<' || tag[len-1] != '>') return false;
    
    int start = 1;
    bool isClosing = false;
    if (tag[1] == '/') {
        isClosing = true;
        start = 2;
    }
    
    for (int i = start; i < len-1; i++) {
        if (!islower(tag[i])) return false;
    }
    return (len-1-start) > 0; // Must have at least one character for