1
1
mirror of https://github.com/theoludwig/programming-challenges.git synced 2024-11-09 22:08:58 +01:00
programming-challenges/challenges/is-palindrome/solutions/c/function/solution.c

19 lines
411 B
C
Raw Normal View History

#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "character.h"
#include "input.h"
#include "string.h"
int main() {
char* string = input();
string = string_to_upper(string);
string = string_replace(string, ' ', '\0');
bool is_palindrome = string_is_palindrome(string);
free(string);
printf("%s\n", is_palindrome ? "true" : "false");
return EXIT_SUCCESS;
}