#include <stdio.h>

char stack[100];
int top = -1;

void push(char c) {
    stack[++top] = c;
}

char pop() {
    return stack[top--];
}

int main() {
    char input[] = {'R','A','C','E','C','A','R'};
    int n = sizeof(input) / sizeof(input[0]);

    int i;

    for (i = 0; i < n / 2; i++) {
        push(input[i]);
    }

    if (n % 2 == 1) {
        i++;
    }

    int isPalindrome = 1;
    for (; i < n; i++) {
        if (pop() != input[i]) {
            isPalindrome = 0;
            break;
        }
    }

    if (isPalindrome == 1) {
        printf("회문입니다!\n");
    } else {
        printf("회문이 아닙니다.\n");
    }

    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: