// editor1
#include<stdio.h>
#include<stdlid.h>
#include<ctype.h>
#include<string.h>
#define MAX 5
int stack[MAX];
int top = -1;
int isValidInteger(char *str) {
    if (str == NULL || *str == '\0')
    return 0;
    if (*str =='-')str++;
    while (*str) {
        if (!isdigit(*str))
        return 0;
        str++;
    }
    return 1;
}
viod push(int value) {
    if (top == MAX -1)
        printf("stack overflow\n");
    else
        stack[++top]= value;
}
void pop() {
    if (top == -1)
        printf("stack underflow\n");
    else
        top--;
}
void peek() {
    if (top == -1)
        printf("stack is empty\n");
    else
        printf("%d\n",stack[top]);
}
int main
{
    char input[100];
    int value;
    char *commands[] = {"push 10", "push 20", "peek", "push abc", "push 30", "peek", "pop"};
    int n = sizeof(commands) / sizeof(commands[0]);
    for (int i = 0; i < n; i++){
        strcpy(input, commands[i]);
        if (strncmp(input, "push ", 5) ==){
            char*numstr = input + 5;
            if (isvalidInteger(numstr)) {
                value = atoi(numstr);
                pusk(value);
            } else {
                printf("Invalid input\n");
            }
        }else if ()
    }
}
}