/* Roman Dubov */

/* Palindrome tester */

#include 

#define STACKSIZE 30

    struct stack{

    char item[STACKSIZE];

    int top;

};

    void push(struct stack *ps, char string[30]){

      

        if (ps->top==-1){

        /* printf("%s\n","The stack is empty.\n"); */

    }

        else {

        ps->top=ps->top+1;

        ps->item[ps->top]=string[30];

    }

    /* printf("%s\n", string); */

}

    int pop(struct stack *ps){

    char x;

        if(ps->top==-1){

        /* printf("%s","The stack is empty.\n"); */

    }

        else{

        x=ps->item[ps->top];

        ps->top=ps->top-1;

        return(x);

    }

void main()

    {

    int true_value;

    char st[30];

    int i=0;

    int j=0;

    char y;

    char temp;

    struct stack s;

    s.top=-1;

    printf("Enter a string to be tested (enter '.' to indicate\n"

      "the end of the string):");

    scanf("%s", &st);

        while(st[i] != '.'){

          push(&s, st);

          i++;

    }

    printf("--------------------------\n"); 

    printf("Number of characters is %d.\n", i);

        while(j

             if(st[j]==st[i-1]){

            temp=pop(&s);

             true_value=1; 

             }

                 else{

                 true_value=0; 

                 }

                 j++;

                 i--;

                 }

                     if(true_value==1){

                      printf("--------------------------\n");

                    printf("The string is a palindrome.\n");

                    printf("--------------------------\n");

                     }

                         else{

                          printf("--------------------------\n");

                          printf("The string is not a palindrome.\n");

                          printf("--------------------------\n");

                         } 

                    }